The wallet follows the traditional way to derive the public key from the private key, so you will see the address as p2pkh address.
You must define the wallet that you want to derive p2wpkh-p2sh/p2wpkh from the address by adding the appropriate word before importing the private key.
The solution above is correct, as you can try with electrum console:
key = 'your_key'
txin_type, secret, compressed = bitcoin.deserialize_privkey(key)
wif2 = bitcoin.serialize_privkey(secret, compressed, 'p2wpkh-p2sh')
print(wif2)