[1.7.x] Fixed #23294 -- Add related_name to existing migrations.

Thanks to Florian Apolloner for the review; refs #23288.

Backport of 1d79d08d9a from master