This is mostly a matter of control systems engineering: inverters tend to be perfectly grid-following, but there's no reason why the phase angle can't be adjusted to provide "virtual inertia". Same for battery systems - an early market for these in the UK is getting paid for "fast frequency response". Every battery can be a virtual flywheel.
https://www.modernpowersystems.com/analysis/batteries-for-fa...Conversely, the Spain problem appears to have been a classic control systems problem of a slow undamped oscillation that gradually got out of hand.
(I believe the preliminary incident reports got published and discussed on HN, if someone would like to link that here?)
Nuclear may or may not have a role, but it's much slower to build than solar, so starting a plant now is going to face a very different landscape with a lot more solar in by the time it completes.