Car engines have pretty bad efficiency. You're looking at something like 25-30% typically, and that's peak efficiency. Car engines usually run well off peak efficiency because they're not at optimal RPM or power output, and then you lose even more when braking. Add on another substantial portion for refining and transport.
A modern power plant can be 60% efficient or more. You lose about 6% in transmission, and then another 5-10% in the rectifier, battery, inverter, and motor.
Do you? I mean... we're still going to refine petroleum if we go to electric cars completely, if only for industrial purposes. Even then I think it's going to be a while before anybody proposes electric passenger jets or electric cargo freighters, so there's still going to be refining and oil exploration. I am not really sure it is correct to assign 100% of the cost of that to cars.
It's the same thing with electrics. You don't assign the entire energy lost in the power grid's wiring to EVs. You assign them the percentage loss on the energy they consume.
To obtain a gallon of gasoline costs a certain amount of energy which implies a certain amount of emissions attributable to that gallon. If you're looking at the entire efficiency of a gasoline car in terms of miles per unit of CO2 emitted, you need to account for that. The same goes for a kilowatt-hour of electricity and accounting for the miles-per-CO2 of an EV.