[mypyc] Fix using values from other modules that were reexported (#7496)
There are a couple parts to this:
* Compile module attribute accesses by compiling the LHS on its own
instead of by loading its fullname (which will be what mypy thinks
its source is)
* Only use the static modules if they have actually been imported
Fixes mypyc/mypyc#393.