reinit Main by clearing everything in it after building the sysimg

Continuing the discussion started in #5687.

We can't compile the sysimg twice because of old crap left in the Main module. This implements a `empty!(::Module)` functionality so that Main is left in an almost pristine state after redefining Base.