simplify Main.Base initialization and fix #7245 in the process

@JeffBezanson please confirm that this won't cause performance regressions. I think it should be fine, since I didn't reset the typeinf function pointer.

I am moved the reinitialization of many global constants much earlier in the build process, so that the first and second build are more similar. This change will hopefully allow simpler usage of these types while building the system image (since there shouldn't be old instances and type pointers hanging around as much to confuse things).
I think all of these should be done when replacing `Base`, not `Main`, since in the future we might want to be able to create a new `Main` that reuses the old `Base`.