I don't think the concern was that there'd be a coup so much as it was that the military commanders would get out of control and end up running everything.
The President just fires the JCS and appoints new, competent, non-lunatic officers.
Of course, there is one smaller problem. Am I right in understanding that the actual generals and admirals on the Joint Chiefs do not actually command enough troops to even arrest a president?
Some folks would argue that has happened. I've seen claims the JCS refused the Regan White House idea of invading Nicaragua in the mid 1980s. Better documented is the "Admirals Revolt" of 1948. The navy admirals leading the way in that were not of the JCS level but they did disrupt the plans of Sec Def Louis Johnson.
There are some strong arguments CoS US Army MacArthur ignored President Hoovers orders or guidance and ordered the soldiers into the Bonus Army camps, expelling the Bonus marchers and burning the camps.
Further from the chiefs of staff there was the bizzare incident where USMC General Smedley Beutler claimed a group of East Coast businessmen had asked him to head a army of disgruntled veterans in a coup against Roosevelt. Everyone Beutler accused denied everything when questioned by a Congressional committie.