Loader checks to ensure plugin soundness with reinstallable GHC
@wz1000 noted an interesting difficulty when working on reinstallable GHC: plugins require a fair amount of care. In particular, imagine that we have the following:

Here we see the build graph of a typical GHC build in a world where the `ghc` library is reinstallable:
* Hadrian uses the bootstrap (stage 0) compiler to build a stage 1 `ghc` and `ghc-bin`
* Hadrian uses the stage 1 compiler to build `ghc-prim`, `base`, `template-haskell`, etc.
* Hadrian uses the stage 1 compiler to build stage 2 `ghc` and `ghc-bin`
* the user (e.g. using `cabal-install`) uses the stage 2 `ghc-bin` to build a "stage 2b" `ghc` and `ghc-bin`
* the user wants to use the stage 2 toolchain to build a package using a compiler plugin
This situation requires great care. In particular, we need to ensure that the plugin is linked against the same `ghc` library that the `ghc-bin` it is loaded into is linked against. The linker needs to ensure that this is the case and raise an error when it's not.
Currently this is problematic as `ghc.cabal` overrides its unit ID, meaning that the stage 2 and stage 2b `ghc` libraries will be indistinguishable. This will need to change.
issue