[1.7.x] Revert "Fixed #23474 -- Prevented migrating backwards from unapplying the wrong migrations."

Backport of d7ab2cefb7 from master