In "most" military situations, the enemy would not want the dam destroyed - because it's a valuable part of what they want to conquer, or doing so would flood their own supply lines, or whatever. And having a well-placed reservoir could save your butt if a https://en.wikipedia.org/wiki/Firestorm#City_firestorms got started.
To keep providing power to the grid, everything from coal to solar to nuclear needs "forever" maintenance. Yes, an unmaintained dam is a hazard. That can be neutralized with a strategic breach, or (some locations) letting the reservoir silt up. But high-rise buildings, flood-control dikes, and quite a few other things are also "people die if not properly maintained" hazards.
The Banqiao dam failure alone is the worst power plant failure in human history by several magnitudes.
Not many dams have the potential to kill that many, but there are thousands of damns with potential to make Chernobyl look like a minor little affair.
As for wars, you just need to go back to 2023 for the last major dam to be blown as part of war. It "only" made 60k people homeless and killed 200-300. Just last year another dam was hit by drones but didn't burst.
Between the direct costs (at the plant), and still having a 1,000 sq. mile exclusion zone 40 years later, Chernobyl really isn't overshadowed by the potential of thousands of dams.
And by the hellish standards of that war - https://en.wikipedia.org/wiki/Casualties_of_the_Russo-Ukrain... - 200 to 300 dead is a rounding error.
That is the weakest aspect of hydro - it causes massive green house gas releases during and in the aftermath of construction, and destroys vast ecosystems.