Yes, of course normally the ruler is chosen according to the country's constitution. But if you have a violent revolution, then you can do what you like as long as you have the force to do it. If you have the army on your side, that really helps.
So yes, if you get control of the reins of power, say as in this case by taking over the important government buildings, you can get away with almost anything. Of course it mattered WHICH buildings!
There are all kinds of examples throughout history. Take the French Revolution - the people hated the monarchy and the way it didn't care about ordinary people, they rose up against the king, and by sheer force of numbers they could take over (and execute the king once they got their hands on him). The English Civil War - the king annoyed Parliament so much that eventually they went to war with each other, Parliament won, they tried the king for treason and beheaded him. That trial was strictly illegal but as I said, if you've got the army on your side, who's going to argue and get shot? Going a lot further back in English history, there was the Norman Conquest of 1066 - the Normans invaded, killed the king at the Battle of Hastings, and took over the country because they had the force to do it. England was ruled in French for the next 300 years (which explains why our language has so many French words in it, including just about everything to do with law and order).
South American countries have so often had revolutions and again it's all by force of arms. It happened in Greece not so long ago - there was a military takeover that forced the king out in 1967, and ex-King Constantine has been living in England ever since. Just last year in Zimbabwe, President Mugabe was forced out and that was basically engineered by the army. Fortunately Mugabe could "see the writing on the wall" and resigned before he was pushed out.
I could go on and on - but yes law and order will go right out of the window if you can take over by force. In war, anything can happen and it's so often a matter of picking up the pieces afterwards. Be thankful for living somewhere where the law on who should govern actually IS followed! That probably accounts for less than half the countries in the world, even now.