Applying already merged [#30869] Incorrect table names used in the #__content_types table.
Thanks Elin Waring.
Applying changes from PR1280 (https://github.com/joomla/joomla-cms/pull/1280) which is RTC