What prevents wallet software from spending from non-segwit addresses using the segwit address corresponding to a common public key?
Nothing. Whoops, misread that question.
Yes I know this, when we give the command RPC dumpwallet "destination", in the document just below the private keys, each segwit P2SH address has its redemscript but I do not know how to use it and I do not even know what the utility of that redemscript is. The Electrum wallet shows the new private format of the private keys of the segwit addresses, but no other wallet recognizes, only Electrum, if we import bitcoin-QT a bech32 private key generated in the Electrum of the error, because bitcoin-QT does not recognize the private key of bech32 address of Electrum
You can't use it in another wallet unless they support explicitly setting a redeemScript or explicitly saying that a given private key should be used for segwit.
Interwallet compatibility with importing/exporting private keys is not very good and it never really was something that was worked on in the past. There is ongoing work to standardize a format for segwit private keys.
Well I remember reading achow101 saying that if you had an old bitcoin-qt wallet.dat and opened it with 0.16 it will automatically convert it to the new format and you don't need to do anything annoying like creating an empty one and sending all of your coins over the new wallet.dat which is hell.
No, you either misunderstand or misremember what I said. It "converts" the wallet so that it can be used for segwit, but no actual conversion happens because nothing in the wallet format needs to change. It is partially backwards compatible; if you go back to too old a version (older than 0.13.1), your wallet won't work as you expect it to.
I hadn't seen that. Thanks.
I wonder what electrum implemented if there's no standard yet. But I see that's been asked/wondered there
Electrum tends to implement their own formats for things and not get them standardized. They have implemented their own segwit private key, public key, seed, and signature format which is specific only to Electrum (the signature format might work with Trezor).