As is known the Roman Republic emerged as a result of the revolt against the King, who angered Romans by committing many despicable acts (such as raping wives of the Roman warriors that were away from Rome at war, etc.). The Romans rightfully decided that the root cause of the evil was not that particular King but the very idea of the unlimited power of one person. Remarkably that they went even further and decided to not only build a political system without a King but also establish safeguards against those who might want to restore the old order and become King. This is how the Roman Republic came about.
Its architects rightfully thought that military commanders are people that are most prone and in the best position to attempt to overthrow republic and become King. But primarily they were concerned with the top military commanders (although nowadays military coupes are mostly headed by the middle-tier ones). That is why they decided to have not one top commander but two and separate them either in time or in space: either one of them was in charge on the even days and the other one - on the odd days, or one was in charge of half an army and the other one - of the second half. The commanders were named consuls and the tradition of appointing two consuls at a time had began.
Apparently the architects thought that consuls would always be in each other's way to seizing power. They did not envision that consuls might conspire to share the power. Surprisingly, consuls never tried to for several hundreds years.
Another safeguard put in place by the architects was the law prohibiting consuls from commanding anyone within the boundaries of the city of Rome. Soldiers were instructed to disregard consul's orders when in Rome. It did not cross the architects' minds that consuls could bribe soldiers and entice them into obeying commanders everywhere. Nevertheless nothing like this happened for almost several hundreds years.
The safeguards seem naive. Nevertheless there were no occurrences of either consuls' conspiracy or the Roman army invading Rome for centuries. Only close to the end of the Republic when army no longer consisted of the native Latins but rather of peoples from all over the places, the attempts to conspire and march on Rome had begun.
This means that coupes had not been happening not because of the safeguards and the laws but because of the vast majority of the Romans believed in the righteousness of the idea of a republic. The laws and safeguards were just decorations to these beliefs and people did not violate them out of conviction rather than out of the fear of punishment.
But as corruption of the elected officials grew, the convictions gradually disappeared. Also Rome had been gradually inundated by alien peoples, which never shared the beliefs in republicanism. As these alien people became the backbone of the army (which seized to be the citizens' army by the end of the republic) the safeguards and laws stopped working. Consuls started conspiring, armies started marching on Rome, and soldiers started eagerly obeying consuls within the city's boundaries.
Beliefs and convictions of nations are meta-systems of their laws and orders. No one tends to obey a law which he or she does believe to be just. Those nations are law abiding whose laws are in accord with the beliefs of its peoples.
Beliefs of nations are their quantum states. Once attained (as a result of a crisis or a social upheaval) the quantum state of nation's beliefs remains intact for quite some time until next crisis or upheaval. Gradual erosion of beliefs may take place but usually confined to a relatively small fraction of the population. This fraction spearheads change as an opportunity presents itself.
The Roman republic lasted long because its people believed in its principles for long time. Safeguards were weak and symbolic, which were easily broken as soon as beliefs disappeared (partially out of corruption and partially out of swallowing Latins by flocking to Rome alien people, which never shared their convictions).
Meta-system is the source of the strength of a system. The best way to destroy a system is to destroy its meta-system.