I don't know much about coups actually work, but a general does not make an army.
A general that wants to stage a coup seems like they must still require the support of the troops.
Speaking anecdotally, every unit I've been in not a single man would follow the questionably illegal orders of any general unless they had full respect and confidence in that general, and typically the troops only have full respect and confidence in a subset of their immediate leaders (which are not typically generals). I guarantee a LARGE percentage of troops would treat the highest ranking general as an enemy combatant if their direct (low ranking) leaders who they respected convinced them that the general's orders were illegal or against their oaths. Soldiers don't die for generals, they die for each other, and "each other" is usually enlisted or low-ish ranking officers (maybe captain and below in the US). A professional and disciplined soldier will charge a hill risking certain death on the orders of a general, but a professional and disciplined soldier will not stage a coup on the orders of a general alone.