"I think the issue has to do with FM not refreshing the variables on a record to record level."
Refresh can be an issue but shouldn't be even in list view. Version 11 works without script or triggers at all (except single 'I declare' and merge variable field) and in 12.0v2 (on windows) it only requires a trigger OnRecordLoad with simple Freeze Window. I haven't tested on Mac nor have I tested 12.0v3 yet. YMMV.
The secret is to place the 'I declare variables' UNDER the merge variable which forces it to refresh on every row. Attached is an example. And sometimes in very complex situations it requires a bit more such as Refresh Window or simply isn't worth it. But most times it is.
Example files in both version 11 and 12:
i had the "I declare" in the header which works fine in form view. Of course it should be in the body. I'm on iPad at the moment so couldn't open the example.