I’m wondering if there’s any way to make a variable automatically save its old value, so that I can, e.g., write a minor mode that will automatically restore the old values of variables when it’s deactivated (without having to declare a bunch of -old-value
variables).
There is no built-in automatic way; you will have to backup your old values any way you want; create a bunch of new symbols, put them into a hash table, a list, or whichever else strategy you prefer.