Setting/writing/modifying session file history?

So we have history expansion, and it allows us to read it in a nice format, but is there a way to write into it? For registers we can use set-register command, and it allows us to have eg command history. But what about undo changes?
More specifically if there was a way - persistent undo would be feasible.

Currently, no - there’s no way to reload a previously-exported edit history.

The current history-export system was added for the benefit of tools that incrementally update external state - when you modify one line in a file, a clever syntax-checker can just re-check that one line instead of having to recheck the entire file from scratch. Reloading old history is not necessary for that use-case.

There’s still interest in providing this feature, of course. See #2649 and #2021.