[Git][ghc/ghc][master] Respect `-fdiagnostics-as-json` for core diagnostics (see #24113)