setSessionDynFlags can't be called twice if package database arguments change
See this example, setSessionDynFlags is called twice. The second time there is a new package database argument.
```hs
import GHC
import GHC.Unit.Env
import GHC.Driver.Env
import GHC.Plugins
import GHC.Driver.Monad
import GHC.Prelude
-- No sign of new db in output:
-- "Just [DB: <libdir>/package.conf.d]"
bad :: IO ()
bad = runGhcT (Just "/home/matt/ghc-bytecode/_new/stage1/lib") $ do
df <- getSessionDynFlags
-- The first call simulates having modified the DynFlags once before
setSessionDynFlags df
setSessionDynFlags $
df { packageDBFlags = PackageDB (PkgDbPath "/tmp/nix-shell-4063774-0/ghctest-3ad8hivh/test spaces/testsuite/tests/cabal/pkg_bytecode.run/bytecode.package.conf") : (packageDBFlags df)
, packageFlags = [ExposePackage "testpkg" (PackageArg "testpkg") (ModRenaming True [])]
}
hsc_env <- getSession
pprTraceM "res" (ppr $ ue_unit_dbs $ hsc_unit_env hsc_env)
main = bad >>= print
```
After the second run, the new database isn't loaded and the `testpkg` fails to get found.
The problem is that if the package database arguments get set once then the cached value is always reused, even if the package database argument is changed. See line 1520 in GHC.Unit.State.
```hs
1519 -- if databases have not been provided, read the database flags
1520 raw_dbs <- case unitConfigDBCache cfg of
1521 Nothing -> readUnitDatabases logger cfg
1522 Just dbs -> return dbs
```
issue