So the military should respect the constitution, but when it comes to a coup you'll get whichever general respects the constitution the least.
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.
You need a general with likeminded officers, and a convincing excuse for the rank and file to go along with their officer's orders.
Something like "the election was stolen, the winners weren't legitimately elected, we've got to defend our country". It doesn't need to survive detailed scrutiny, a few hours is long enough for the major scrutineers to accidentally fall out of windows.
In the US, military officers take their oaths to obey the constitution, not the president. I don't know if that's true in South Korea.