I will support and defend the Constitution of the United States against all enemies, foreign and domestic...
There is nothing ideological in that.
It doesn’t say “I will interpret the constitution and decide if it’s being followed and if not stage a coup,” though. Interpreting is the judiciary’s job. The military is at the beck and call of the executive, who is checked and balanced by the judiciary and legislative. If the executive branch wants to implement socialism, it’s up to the other two branches of government to stop him, and if he fails to listen to them, they order the military to carry out their previously determined impeachment, and remove him from office. Thus, the military cannot intervene unless directed to in a manner consistent with the constitution.