The merger and assembly histories of Milky Way- and M31-like galaxies with TNG50: disk survival through mergers