The ability to quit is one of the most important powers that the average employee has.
Certain types of managers have a habit of thinking that they are infallible, and can treat those who work for them however they feel like. A walkout is one of the few things that remind them that a company is just as dependent on the happiness of its employees as it is on management making decisions to keep the shareholders happy.
That being said, taking the decision to leave a job is rarely a choice that is made lightly. In the job market we have these days, it often feels safer to stay in the role that we have, even if it makes us miserable. The fact that some managers are still able to act in a way that is so outrageous that it inspires impromptu resignations means that their behavior must be quite something. Knowing your worth is a very important skill to cultivate in the workplace, and if those you work with do not appreciate that properly, they need to be shown that you will appreciate it regardless. There is a chance that next time, they will think twice before doing something to disrespect an employee.