driver: Use correct DynFlags when emitting unecessary source pragma warning
We were using the global DynFlags in order to determine whether to emit the unecessary source imports warning, instead we should use the per-module DynFlags so that local GHC_OPTIONS are honoured.
Fixes #24631