Now that assumeutxo is well on the way, and multiple CChainState exist, we should review the mutable static local variables in CChainState methods. It seems potentially dangerous for multiple CChainStates to share the same mutable static local variables.
ref T3378
This is a backport of core#26513
Depends on D15001