I can't think of a solution that will work in this case. I'm hoping someone else has some ideas. This is the situation as I understand it:
If the variables are hardcoded on your site, they will always be ready to fire right when DOM ready hits.
But a trait of async loaded scripts, like utag.js, is you can't tell when they'll load. Sometimes this will be before DOM ready, sometimes after. The extension you made will therefore fire at DOM ready or later, providing inconsistent results. It's one of the reasons why we recommend having the UDO on-page right before you load utag.js. The data you want to use has to be available before we load or you will run into timing issues.
Why are the variables wrapped in DOM ready? Maybe we can help you think of other options with more details.