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
make isempty(itr) work for general iterables (as mentioned in #5797)
fix missing gc root in ifelse(). fixes #5813
Merge pull request #5821 from JuliaLang/jb/replace_main

add an internal function to replace Main, use it in sysimg.jl
Merge pull request #5827 from stevengj/isempty

RFC: make isempty(itr) work for general iterables