Today I learnt that Emacs has a notion of 'permanent' variables! https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Buffer_002dLocal.html
These are variables that persist even when you change major mode (which generally resets buffer-local variables).