There is a simple fix: the government cannot possess any weapon that it denies to individuals.

If you cannot own a fully-automatic firearm, the Army cannot own any. If you cannot own an air-to-air missile, the Air Force cannot own any. If you cannot own a nuclear missile sub, the Navy can't have any.

This would eliminate outright bans, although regulatory restrictions that tend to favor people supported by military infrastructure would likely replace them. Perhaps you would be permitted to own and use fully-automatic rifles, but you would also be required to regularly train, register, and qualify in their use, such that it would be a surmountable and nondiscriminatory barrier to ownership, albeit one more easily passed by military employees in the regular course of their duties.

There is no particular barrier currently imposed by the second amendment with respect to requiring that those who do keep and bear arms be proficient in their use. It may even be supported by the "well-regulated militia" clause. You may bear arms, but if you do, you must also be able to use them proficiently.

As I interpret it, the 2nd amendment allows me to own and carry any weapon of military significance, without regard to the threat it may pose to myself and my neighbors, from a simple, throwable rock to my own multi-warhead ICBM with tunable, independently-targeted payloads. It is incredibly obvious that latter possibility is not very compatible with modern civilization.

If anyone is going to have private weapons of mass destruction, I would certainly want some limitation on their use, like the "odd man" failsafe-override procedure in Andromeda Strain, where those people with ultimate control over that weapon can satisfy some simple, objective criteria that ensure its use is rational, ethical, and viewpoint-agnostic. This should allow an equal possibility for using something in an armed rebellion, or for the government to use it to suppress one.

The government nuclear infrastructure already has safeguards against improper use of arms. Psychological screening, inventory controls, and authorization procedures, to name a few. If private individuals or organizations were required to implement substantially similar safeguards, no one would bother owning any, because the weapons are simply too expensive to maintain, for something that you are never likely to be able to use and still remain the good guy.

If you think of the government as just a lot of regular people doing their jobs, allowing regular people to have military-grade weapons as an expensive hobby is no more threatening. A Wyoming ranch owner with a nuclear missile is not more threatening than a Wyoming silo-bunker lieutenant with a nuclear missile, if they both have to get approval from someone presumed rational before they blow anything up. The latter has his military chain of command. Perhaps the former has to call up the county sheriff for his launch codes. Donning the uniform does not somehow make a person more qualified to handle a weapon. So if something is too dangerous for an individual, it is certainly too dangerous for an individual with a specific employer with an organizational structure geared around dilution of individual responsibility.