Fixed #23444 -- Prevented unnecessary ContentType object creation when using inlines

Migrated from this PR:
https://github.com/django/django/pull/3201