You are correct, but conversion from thermal to electricity is quite inneficient. and it represent 60% of global electricity production. So driving a tesla is more efficient IF it comes from renewable.
But with heat pumps (backed up by resistive heating since we get cold enough to need it), we can still get a win there. Natural gas and coal generation can be ~30% efficient, but heat pumps can readily have a 4:1 COP or better. Even factoring in the inefficient generation of electricity we can still heat our homes with net less energy and then focus on replacing our electricity generation with less polluting sources (eg a mix of nuclear baseload, wind+solar+battery, and natural gas as a fallback)
They are sufficiently more efficient (roughly 4x) than even adding the 60% inefficiency of gas turbines and electricity transmission, charging losses etc. do not destroy their inherent efficiency advantage.