EM weapons have two advantages :
Higher muzzle velocity. Gas expansion is limited by speed of sound so increasing muzzle velocity is limited by available propellants. Although you can use electricity to heat the propellant beyond what chemical reaction could provide and this might be simpler upgrade than a coil gun.
Lack of muzzle flash. Not propelling expanding hot gas in front of you reduces noise, flash, and recoil. Suppressors already do that, though.
And two disadvantages :
Lots of electric power needed. Energy needed (as mentioned in the question) goes up with the square of velocity and the time you have to provide it goes down with velocity. So power goes up with the cube of velocity. The expanding gasses work as a kind of spring that store and release the energy. A coil gun needs to provide a reusable solution for power. And it needs to be dense too. And reliable. And affordable.
The EM pulse from a coil gun is probably detectable and locatable from some distance. It is faster than your projectile too. This can probably be ignored unless you are shooting at a main battle tank with an active defense system.
There are some other differences that give no clear advantage either way IMHO but might be significant in some specific case. For example modern ships might have enough power generation to power a coil gun effectively. In such case not needing to bundle propellant with ammunition would be a good thing in every way. But for other uses meeting the power requirements in some other way is as mentioned before more pain than the bundled propellant and cartridges.
Now to actually answer the question... maybe?
Basically for coil guns to happen the benefits must be important while the disadvantages need to be managed somehow.
Mainly we are talking about muzzle velocity here. There needs to be some use for very high velocity projectiles.
It does help with armor penetration. So it could replace sub-calibre rounds in tank cannons. But modern cannon can already solve this issue by shooting any number of rounds designed to penetrate armor with explosive power (HEAT, SEFOP, HESH and so on). These seem a simpler solution and it is already available. It seems unlikely anyone would develop coil guns for this.
But you could assume HEAT and its alternatives were never invented for some reason. It seems very unlikely, though. And HESH works using a different principle so you'd need everyone to miss two fairly obvious developments.
It helps with range. But you can just use missiles. Or reduce the distance by attacking from an aircraft. And better the range of your gun is, more likely your ability to target or detect the target is too be the issue. It would be useful but probably not often enough to justify replacing existing weapon systems with coil guns.
If guided missiles were not available, having a tank cannon that can shoot farther might be worth the effort. Similarly an A10 with coil gun might be useful if it could not carry all those missiles and smart bombs.
It helps with accuracy. Less time the projectile needs, the less time wind has to mess with it or the target has to move. This might be useful for snipers or air defense systems. Snipers also benefit from not having a muzzle flash. But, of course snipers already have good guns and the US had no real air defense shortage in any recent war, so you'd need to go far back or assume WW3.
That seems pretty depressing for coil guns. I think we might need a drastic change to justify coil guns. If modern propellants were not available and people were stuck with gunpowder for propellants coil guns would look very valuable for accuracy. If they also had no good explosives, coil guns would give superior armor penetration. If guided missiles do not exist or your war happens before they do coil guns might be useful for long range weapons in vehicles.
If you can deal with the disadvantage...
So you do not need to just remove some technology to create a use case, you need to add a way to provide the power.
Simplest way would be to get better batteries and then use capacitors to develop the pulsed power. But it seems unlikely that anyone had batteries that good available in some past war. Especially if we also need to assume they do not have electronics for guided weapons... High temperature superconductors might enable it, I suppose. And make the coil gun much more efficient as well.
It might be better to use a generator that is inherently pulsed. The various explosive power generators seem the best bet. There are several types but the general idea is that you have an electric or magnetic field and use explosives to change it very rapidly. Piezoelectric materials can also create rapid pulses of power with explosions. So you could assume the development of efficient pulsed power generator at any point past hundred and fifty years or so. But this really just moves the explosion from your cartridge into a connected power generator.
Either way, you are just moving the power generation and storage from the cartridge to somewhere else. It is hard to imagine this being useful unless you already have the power generation capability (ie. that ship mentioned before), or propellants are much less advanced and you have unrealistically good and portable power generation or storage.