fixed #23503 -- fixed renaming of model with self-referential m2m field