To put it in perspective, the inventor of the first lithium battery, John Goodenough, a work he later received the Nobel prize for, was a world renowned material scientist at the top of his game, who led some of the most advanced research labs at MIT and Oxford. This was not some scientific serendipity, a low hanging penicillin; practical lithium batteries had to be plucked from the bosom of physics using the best tools and knowledge available in the 70s.
How many electron microscopes, X-Ray crystallography machines, mass spectrometers, computer aided simulations and design systems and other contemporaneous tools, methods and theories had to be used by Goodenough's team and then the thousands of researchers in the subsequent decades to get to the point we are today with lithium batteries? It just doesn't sound like something that was possible pre-1940, the period where the bulk of the ICE improvement happened.
And you really need lithium chemistry for practical EVs; despite the enthusiast conspiracy theory, the General Motors EV1 was nothing more than an clunky, expensive curiosity that failed in the marketplace. The only way EVs could become practical reality (if barely) was that the ICE stop improving, hampered by emissions regulations, to the point where advances in lithium battery technology and economics could catch up. Such environmental concerns were pure fantasy more than a century ago.
Another issues to consider is that, even if not used for road transport, ICE were essential for aviation, the history of aviation being, to a fist degree approximation, a history of high power density propulsion methods that made mechanical flight possible. Major improvement of road engines (for example turbocharging, fuel injection, VVT) came from aviation. Since electric aviation remains still a dream, it follows that any counterfactual road transport history must account for the existence of a highly competitive aviation ICE.
When imagining these fun little scenarios, like what if the Roman Empire invented the steam engine or Victorians the microchip, we almost always tend to discount the highly contextual nature of scientific discovery and innovation. Previous scientific and technical progress alter the world in profound and subtle ways, transforming what was once considered a pipe dream - and not for lack of trying and visionaries - into reality.