In Krita, gradient presets in Krita are treated like "resources" like brushes.
This means that it's possible to create a new gradient preset for a gradient in one file and then edit that preset in a different file, and when you return to the first file Krita will simply render the gradient in a completely different way from how it looked when you saved it!
This is an obvious bug in how Krita is programmed. It makes no sense for it to work like this.
Upon testing, I noticed that Krita actually stores the values of the gradient present in the .kra file, but it seems to also store which preset those values came from. Krita will try to "reload" the values from the preset without the user's interaction, leading to overwrite the values that were stored in the file. In particular, this happens when opening the file or when opening the layer styles dialog.
Ironically, if you delete a layer preset after setting it, Krita won't have a preset to load the values from anymore so it will not overwrite the gradient values saved in the file. Normally deleting a preset will select a different preset, but you can manage to delete the preset without changing the preset by deleting it from the layer styles dialog of a different layer.