At the end of the day all the power to drive the car has to come from the petrol or diesel engine.
That's not quite so.
1) A car spends a lot of its time at low power, which is OK with electric but a petrol engine is inefficient, and would be better used running at a higher power setting charging the batteries. In fact the efficiency situation is so poor that a small gas turbine (which is normally a lot less efficient than a piston engine) is viable, just to run more or less nonstop, as the battery charger - e.g.
here. (I know the people who designed that one).
2) You can do regenerative braking
3) You can do direct drive to the wheels, which avoids gearbox (and diff) losses
But I agree the technology is in its infancy; IMHO largely because nobody has yet been able to do a commercially viable design "properly" i.e. direct drive brushless motors on each driven wheel, and a turbine charging the battery.
There are some major long term issues. If all current liquid fuel vehicles were suddenly charged from the mains, one would need to build many more power stations and totally overhaul the distribution grid. Especially with the steam cycle limiting PS efficiency to around 50%, it would mak sense only with nuclear fusion, which has had a great future for about 50 years now
And, because mains electricity is currently much cheaper than petrol (per kWh), electricity would have to rise in price massively. Not sure everybody would like that.