Precompilation & global variables

If I understand it correctly, when precompiling package A, if a method in A is invoked and modifies a global variable in B, those changes are lost forever, but if the global variable is in A, then the changes are saved?

What exactly are you trying to do? As you noticed by your own question, relying on one package modifying global variables of the other package is something that will be unmaintainable. Independently of the actual answer to your question (which I don’t know if can be generalized), the advice is to not rely on global variables in any sense.