Fixed #23503 -- Fixed renaming of model with self-referential m2m field.