Fixed #23160 -- Correctly rename models with self referential fields.

Thanks to whitews AT gmail for the report.