Culture,
I commented on a "popular revolution," not a palace coup. In the latter case, the lower ranks of the police and military would be loyal to those immediately above them, who would be loyal to those working legally to correct the patently illegal actions of the president (in your examples).
Remember when Alexander Haig declared "I am in control here" after Regan was shot? This would have been illegal, and others in the room immediately objected. He certainly did not get that control. If I remember correctly, he resigned some time afterward, presumably partly under pressure over this misstatement.
The police and especially the military are dangerous systems in which order is strictly enforced. If the common man revolted, the police and military would likely be quite sympathetic, as you point out, but for them to disobey orders, throw down with the rioters and turn their guns on Washington simply would not happen in this country (at least prior to the utter collapse of life as we know it).