That is an interesting thought.
There are pollutants generated by oil and coal plants, some portion of the electricity is lost between the point of generation and the outlet in the garage. I have heard a quarter of electricity is lost in the process of transmission.
How does that compare to the cost of burning fuel directly in a vehicle if those factors above are taken into account? I am sure someone has done that...
What I would prefer is to use nuclear power plants to produce electricity. That would eliminate almost all of the production of excess carbon dioxide.
Then generating plant alone waste more than 50% of the coal/oil energy put in. Then add transmission losses. Then at electric losses in the charging and running of the vehicle.
And keep in mind that coal is a lot “dirtier” than gasoline or diesel - it’s relatively easy to refine out sulfur-containing impurities from liquid fuels - you just boil them and do it by fractional distillation.
But cleaning up solids is a much bigger problem - so even the low-sulfur coals still contain a bunch more sulfur than gasoline (and that sulfur, after combustion, ends up a SO2 and SO3 which have to be scrubbed or emitted).