Nothing you describe so far actually runs the script.
Assuming you run the script somewhere, try deleting the merge variable from the layout and do a fresh insert merge variable there.
Thank you both for catching where the error was. I made a duplicate of this layout some time ago (one for landscape, one for portrait).
The script trigger for OnModeEnter is set-up properly on the Landscape layout, but missing on the Portrait. Since the old document was defaulting to opening in Landscape, the script would trigger and the global variable would work in both layouts. And since I was constantly jumping between layouts, the script kept the variable up to date.
In the new document, I'd been working exclusively in the Portrait layout, so the script never triggered.
I've updated everything and all is well again.