Solar flares should be a lot lower on the list, as the bulk of the risk can actually be mitigated in the electric grid. Every few years the IEEE publishes an article on the risk solar flares pose to the electric grid, and how it can be mitigated by installing capacitors on the multi-ground neutral. Remember: solar flares induce current in long wires, not short ones, so the risk is not so great to individual electric devices were the electric grid protected.
Of course we're human and have a tendency to ignore large scale risks that haven't occurred in recent history as evidenced by the fact that no major electric grids have implemented this kind of protection. If we do get an 1894 level solar flare, many of the high voltage transformers will be fried. Some of them take months to build, so it would take years to recover from that kind of damage.
I'm a big proponent of the DOE's suggestion for a national strategic transformer reserve. They estimate $500mil (2017) would cover buying enough redundant transformers to resuscitate the power grid after a nationwide failure. Pre-covid, the typical lead time for a full scale transformer was ~2 years. I'm assuming it would take even longer now. I can't imagine how long it would take to replace our transformers if ~1/4 of the world also needed to do the same.
In my opinion, the reserve is cheap at 3x the price. $500mil is 7 F35 raptors, and we are buying ~130/year at this point. There are plenty of defense spending justifications for establishing the reserve - it would protect against EMPs and small targeted attacks. We are already seeing small arms attacks on high energy transformers, and last year someone tried to use a drone to take out a substation.
Not surprisingly, the biggest hurdles identified in the report were the needed land acquisitions and the logistics of transporting the large transformers.
Having a full set of spares requires zero re-engineering of the existing grid, and will turn a multi-year grid failure catastrophe into a few days to restore critical components and some weeks of restoring full function.
Since our solid solar observation capabilities now give several days notice before arrival of such storms, some could even be pre-positioned at critical substations.
And you are absolutely correct that the DOD would have very good reason to do this - losing the grid nationwide would be an insane level national security risk.
That could definitely help. However, while I don't have the numbers, I'd expect that the required labor to disconnect them all would vastly exceed the 24-72 hour warning time.
Also, this would mean proactively shutting down the entire grid for days, at the first warning, then requiring days to restore power. So one warning would require a full week of zero power for the continent, and (I expect) saving only part of the grid.
But yeah, putting in some planning to do that would be a smart idea.
Part of the challenge is that transformers for individual homes are at risk. Throw a significant DC voltage across a transformer designed to handle 60 Hz AC, and the results are not going to be pretty.
Of course we're human and have a tendency to ignore large scale risks that haven't occurred in recent history as evidenced by the fact that no major electric grids have implemented this kind of protection. If we do get an 1894 level solar flare, many of the high voltage transformers will be fried. Some of them take months to build, so it would take years to recover from that kind of damage.