I beg to differ.
There are already entire countries that started outright banning ice machines from much earlier than 2040:
https://en.m.wikipedia.org/wiki/List_of_countries_banning_fo...
India as an example of a growing market is banning them in 12 years, Germany as an example of the western world “capital of cars” the same.
These pledges were made well before Tesla model 3 was distrupting the market, and as noted there, Tesla may still be just a minority player if China picks up steam.
If things ramp up as fast as it seems we may still have an almost global ban by the 2030s and from there the oil industry is pretty much done.
The only showstopper for this scenario is the lithium availability and the alternative battery technologies viability, obviously.