codegen: Mark resolved `const` `GlobalRef` as method root (#60945)
This allows `--trim` to safely* prune bindings without dropping the root
required for the generated machine code.
The (significantly more complex) alternative will be to examine the
bindings (back)edges during `--trim` serialization and reconstruct the
relevant binding dependency edges at that time but that does
not seem worth it compared to the 23.6 KB overhead in the sysimage
to track these roots explicitly.
Resolves https://github.com/JuliaLang/julia/issues/60846.
\* As a caveat, uninferred GlobalRefs can lead to missing bindings at
runtime, but this is out-of-scope for --trim.