This is a partial backport of Core PR13917 : https://github.com/bitcoin/bitcoin/pull/13917/commits/8254e9950f67d750c7f5905bfdef526d825965ed
Also includes:
Only wipe wrong UTXO type data if overwritten by wallet
https://github.com/bitcoin/bitcoin/pull/13917/commits/c05712cb590c8c76729a71d75a290c67ae9e3c06
Both are extensively prunned due to the absence of segwit.