That stuff is directly taken from the XML files.
Easy experiment to see it: Create a game, make a savegame, and then move in the UnitInfos.xml the first unit to the end or something similar. Then take again a look at your savegame, you'll have other units, because the game doesn't really store anything unit related there.