But the private keys of the segwit addresses (both P2SH and bech32) are the same as those of a legacy address when you export a private key from a segwit address in Bitcoin Core and import into Electrum, it appears that you imported a legacy address instead of segwit P2SH or bech32). Do the tests yourself