Fixed #23322 -- Use resolved swappable model for dependency resolution during makemigrations

Patch for https://code.djangoproject.com/ticket/23322

- [x] Patch
- [ ] Tests