Having read through the comments on this bug:
I can see that migrations were not originally intended to support changing AUTH_USER_MODEL after the initial migration.
However I am confused about whether it now should. The later comments and the documentation imply that swappable models
should work provided they have migrations.
I got the same error as reported in the bug report, but the workaround was simpler (manually add a dependency on the initial
migration for the app containing my custom user model to the migration that added a foreign key to it).
Is this a bug that should be reported, or do we live with workarounds?