Earlier quoted context omitted.
It's not like the technology behind railguns hasn't been stable and ready to use for decades now. It's just that, until the more recent invention of ancillary technologies like supercapacitors, it's been so costly to fire them that there was no logical place for them on the battlefield, so we never bothered to operationalize them.
To me, it's not entirely clear why we're bothering. Do we actually envision shore bombardment as a useful combat modality going forward? IIRC the types of ships that can mount this weapon are the same types that are currently vulnerable to hypersonic anti-ship missiles. All our potential equiv-tech adversaries have those, to my understanding. So wouldn't the railgun only be useful against lower tech opponents? And ag…
And in the fog of war... Who's to say that a DD won't be able to close to railgun range of an enemy warship? Life's a lot easier when you can stay below the horizon, after all!