[1.7.x] Fixed #22881 -- Better soft_applied migration detection