Sorry for giving you a lot of work explaining this!
I can see now why sometimes my script could work & others not. I think it did it perfectly once then went back to variable & jumbled....
But I was able to use
MC.RunCmd ID="ExplorerPanel.41075" to get to the
..

I wonder if it would be possible to force custom commands to run in a sequence?
Perhaps you could see a simple way to implement what is perhaps a kind of 'macro' function for Custom Commands. (Maybe they are too exclusive in terms of environment to do this?)
This makes me wonder about a plugin that would batch run Custom Commands + variables, in the GUI frontend.
e.g. Effectively if you had 3 virtual buttons with MC.Commands assigned, the 'macro' would run them in an assigned sequence.
This is a bit ambitious for me to try right now tho!!

I do not know how much work that entails or whether it is worth considering given your full road-map....
Thank you very much for the script I can use that to start over & work towards a real result!

I will post back what I end up with.