Took me a while to see why Cura was confusing the extruder stacks. It worked fine during the actual upgrade itself. Then later after the start-up sequence it suddenly re-wrote them wrongly.
Why is there an ID field in here? Shouldn't it just take the file name as the ID? Stupid!
With this it's starting to look like something. It's no longer giving any corruption errors now with any of my test cases. However e1 is still being set to the definition of e3 for some reason.
Turns out that the parsers apparently refer to a lot of subobjects which are crucial here, and they don't implement the normal copy well. Deepcopy it is then.
Stupid stuff. All of these containers need to be copied. It's not possible to work this out for all materials properly, since we can't read into these materials what their GUIDs and material types are.
It's a LOT more work than I thought, because the new printer has 4 extruders instead of 2. That means that files have to be copied for the other two extruders. A big hassle.