Some of the flaws in your metaphor are:
1) Shareholders are not responsible for the debts of the corporations they invest in.
2) Citizens under a government do not get to decide whether to join or not.
3) All governments claim sovereign immunity and private corporations know that when they contract with them.
Governments are not a private businesses and do not behave like private businesses.
However, municipalities aren't like other governments. They aren't sovereign in the same way as countries, or states (or, in the case of Canada, provinces). They generally derive their authority from the state government; perhaps through a special charter. Whether or not that distinction matters in this case; I don't know — but, it is generally an important distinction.
Also, one of the few, universally acknowledged, functions of government; is the enforcement of contracts. If governments void contracts with impunity; what does that do to their moral authority to enforce other contracts?