add an internal function to replace Main, use it in sysimg.jl

make the Core.Main binding non-constant, so uses of "Main" in general
refer to the *current* Main. Doing "import Main" will give you a
constant reference to the Main at that time.

fixes #5802

related to #1195
Merge pull request #5821 from JuliaLang/jb/replace_main

add an internal function to replace Main, use it in sysimg.jl