Making a variable immune to "undo"?

Twine Version:2.3.14
Story Format: harlowe

So I’ve been working on a story that involves the ability to rewind time, and using the (undo:) macro is extremely useful for this, since it saves me the trouble of reverting every variable change manually. However, I’d like the player to continue to be in a “rewinding” state until they explicitly stop it, and that poses a problem because (undo:) reverts every variable change, including the $rewinding boolean I set.
Since (undo:) halts execution at that point I can’t say something like (undo:)(set: $rewinding to true). Is there any way, possibly using raw JS or something, to make this variable “immune” to the undo operation? Or am I stuck basically re-implementing my own undo functionality to accomplish what I want?

Thanks for any help you can provide!