I tested as a new non-admin user, and the test macro I posted above worked fine. So I don't think it's a non-admin user issue.
When you upgraded each time, did you start fresh, or did you always migrate from the prior KM install? The only explanation I can think of is that the database got damaged early on, and has been damaged ever since.
If I were you, I'd try this: Export all your macros to a backup, then delete everything related to KM. Reinstall from scratch, then restore your macros from backup. Watch the log files for any error messages, and then try a macro with variables.
Sounds like the Keyboard Maestro Variables.sqlite database is corrupted badly enough that sqlite cannot recover.
In Keyboard Maestro, select Help ➤ Open Preferences Folder
Quit Keyboard Maestro Engine and Keyboard Maestro
Trash the Keyboard Maestro Variables.sqlite file
Launch Keyboard Maestro.