This bases the script/standard hash types, TxDestination-related and CScriptID on a base template which does not silently convert the underlying uintN type. Inspired by and built on #17924. Commits are small and focused to ease review. Note some of these changes may be relative to existing bugs of the same sort as #17924. See particularly "Convert CPubKey to WitnessV0KeyHash directly" and "Remove an apparently unnecessary conversion".
Backport of core PR17938.