How is the UN supposed to stop a military coup?
https://peacekeeping.un.org/en/military
Peacekeeping missions have operated as recently as 2004-2017 in Haiti to stabilize the country after a coup (MINUSTAH).
I personally don't trust in UN and don't think of them as an effective organization.
Myanmar was under effective military rule for a long time and only made strides towards becoming a liberal democracy in the last decade - until the coup happened.