Layout breaks when detaching scaled instance object

The component has scaled components inside. Scaled using Scale tool. When detaching instance or detaching all nested instances the layout breaks and can’t be reverted back. CMD + Z doesn’t rever the layout to the state it was before, so I have to use a version history as the only way to roll back.

How to stop Figma from making such a mess with the scaled instances?

ezgif.com-video-to-gif (1)