Improve new handling of metaclass migration on class redefinition.