There was a time when even pro-labor Democrats like Franklin D. Roosevelt would have regarded it as obvious that collective bargaining was incompatible with public employment. Even the legendary AFL-CIO leader George Meany once took it for granted that there could be no "right" to bargain collectively with the government.
When unions bargain with management in the private sector, both sides are contending for a share of the private profits that labor helps produce -- and both sides are constrained by the pressures of market discipline. Managers can't ignore the company's bottom line. Unions know that if they demand too much, they may cost the company its competitive edge.
But when labor and management bargain in the public sector, they are divvying up public funds, not private profits. Government bureaucrats don't have to worry about losing business to their competitors; state agencies can't relocate to another part of the country. There is little incentive to hold down wages and benefits, since the taxpayers who will be picking up the tab have no seat at the table. On the other hand, government managers have a powerful motivation to yield to government unions: Union members vote.
Public employee unions are simply money laundering operations that (a) transfer taxpayer dollars to unions who (b) give a cut to the Democrats who then (c) pass laws to strengthen the unions. There's no logical reason for this scheme to be legal.