Oh I know what the problem is! I just remembered that I ran into this some years ago when bypassing/enabling modulators through scripting - so there's probably another post about this...
Through clumsy scripting I managed to bypass the entire gain chain. This shows up in the xml. Changing the 1 to a 0 solves the issue.
b0dc04f5-7170-4ca7-86d9-d43417f602d6-image.png
And if anyone else is doing something similar (programmatically bypassing modulators) you can check if it's the entry for the entire chain and ignore it:
if (modulator.getType() == "ModulatorChain")