Instead, create a separate function that applies the undo operation of a CTxInUndo object onto a CCoinsViewCache. This method is used from DisconnectBlock.
This is a rebased version of #5192. I had to re-submit it, since the old pull request does no longer pick up changes. The reason for that is that namecoin/namecoin was changed to be no longer a fork of bitcoin/bitcoin, and the old pull request was done via domob1812/namecoin (forked from namecoin/namecoin).