[GHC] #8785: Replace hooks API in the RTS with something better