Probably didn't help that before the outage hit, Spain was running its grid with very little dispatchable spinning generation, and therefore not much inertia.
This is (a) incredibly impressive to achieve and (b) definitely the point at which the battery infrastructure needs to catch up in order to reduce the risk of such incidents.
Just to clarify this a little bit… flywheels are cool for absorbing transients and providing short-term hold-over during a blip but don’t have great long-term capacity.
Spinning reserve in the grid is equipment that capable of long-term generation very quickly. In the case of hydroelectric dams, they will often cut off the water supply to some of the turbines and use air pressure to push the water out of the way; the generator attached to the turning essentially turns into a motor and keeps the turbine spinning. If you need to bring it online, you open the water valve and let the air out.
Similar situation with natural gas-fired simple cycle turbines. They’re sitting there running at low output. Need more? Just add fuel. For combined cycle it might take a bit for the boiler to warm up for full output but having the first stage running full tilt will get it warmed up fast.
In electrical terms 4 GJ is 1,111 kWh. That's about 15 EV batteries' worth, or about £220 worth of retail electricity (at 20p/kWh). So it's a lot compared to the usual domestic things people are used to, but not much in grid terms.
Or if you consider the Irish grid (average consumption around 5 GW) that's enough energy to power the grid for about 0.8 seconds (obviously it's not going to have enough instantaneous power output to do that, but again for a sense of scale).
If Ireland had 10 of them, that'd be 8 grid-seconds worth of energy. Although, of course, actual disturbances aren't going to be that large. A few percent imbalance perhaps?
So if the whole grid had an instantaneous 10% imbalance, one of those units could carry it for 8 seconds.
(EDIT: changed energy numbers to fit the appropriate power grid)
flywheels don't really work synchronously, though. Or at least, if so, they're not very useful as storage. Inverters can simulate inertia just fine, in fact they can simulate a much larger inertia than the corresponding power of spinning generation, leading to greater grid stability (whether connected to batteries or solar/wind, though without batteries its a little 'brittle' if you run near 100% output, as the power needed may suddenly disappear, so this is probably not good practice for the system as a whole. And you still need some give in your inertia so the grid can actually communicate about supply and demand)
They're usually almost more capacitators than they are batteries from an electrical standpoint. They're there to rapidly smooth out the smaller jitters.