Purge `DynFlags` and `HscEnv` from some `GHC.Core.Opt` modules where it's not too hard

Merged John Ericson requested to merge wip/dflags-core-opt-easier into master

Progress towards #17957

Because of CoreM, I did not move the DynFlags and HscEnv to other modules as thoroughly as I usually do. This does mean that risk of DynFlags "creeping back in" is higher than it usually is.

After we do the same process to the other Core passes, and then figure out what we want to do about CoreM, we can finish the job started here.

That is a good deal more work, however, so it certainly makes sense to land this now.

Edited by John Ericson

Merge request reports