What prevents wallet software from spending from non-segwit addresses using the segwit address corresponding to a common public key?
Nothing.
So that means P2PKH or P2SH inputs could be spent respectively as P2WPKH or P2WSH? Transferring to segwit addresses isn't strictly necessary, as wallet software could be programmed to write transactions using the segwit address corresponding to the common public key of legacy addresses holding funds?