I am aware that it would be illegal to do it or to even conspire to do a typical coup, but what I mean by coup is much broader than literally taking over the country by force. What I mean is an illegal military action that significantly alters the government such as using threats of violence to get Congress to pass a law giving them more, but not absolute power over civilians in times of emergency.
Other possibilities are overstepping their powers in a very large way such as when there is no emergency occupying cities under the Insurrection Act or arresting a president without any conviction to make the Vice President commander in chief.