Agreed, it is annoying, but unluckily, this issue that has been existing for a long time is not easy to fix.
The global user variable manager works by returning a value if you ask for a variable, and by prompting the user if a variable doesn't exist yet. So far so good.
Now, the problem is, during the loading of a project and while code completion is running, it may be called a dozen times. If you hit "cancel", it's still being called again. That's the reason why the dialog keeps popping up.
To avoid this happening, one would need to add failure reporting to the user variable manager, and some kind of caching into the project loader and into code completion. However, that would very likely break something, since if the information wasn't necessary, the respective components wouldn't be asking for it in the first place (at least, I hope so!).
Or, one could add a flag into the global user variable manager which marks a certain variable as "undefined, don't ask again", but then it won't do its work for compilation any more