The Mods meta.lsx file tells the game what the unique ID (and other identifying information) for a mod is. This ID is also what is stored in a Save File in the portion that lists what mods are present in the save.
So for the Mods folder merging, the meta.lsx of the original mod stays the same. I haven't tested Mods folder merging myself, but of the other folders in Mods, I am certain that the Localization folder can be safely merged, and am confident that the Globals can be merged fairly safely. I'm not so sure about the Story Goals.