That meme shows up often, particularly from the right (anti-union) wing of the discussion. I don't think there really is much to this argument. In those states where anti-gun laws pass, they do because anti-gun politicians are in the majority, and unions don't get to vote in state legislatures. While unions often financially support the campaigns of democratic candidates greatly, the payoff for that is typically not in laws that reward union members. What we see quite often (and Sacramento is a prime example) is government jobs for union leadership (that's one of the reason California has some many boards and commissions), and financial rewards for unionized government jobs. If you talk to the rank and file of non-government unions, they will tell you that California is actually not at all pro union. For example, overtime pay in Illinois is much better, and the "division of labor standards enforcement" in California is actually very pro-business and anti worker, unlike east coast states where the equivalent organizations are stacked with union staff.
In my opinion, the underlying reason is quite different. California legislators (and much of the gun control movement) do believe that LEOs are on the good side of society, and their presence helps to keep society running well and crime under control. From that viewpoint, it makes sense to have LEOs (including off duty and retirees) well armed.
Now politically the left wing has a love-hate relationship with LEOs. While they love them to protect little old ladies and kids playing in the park, they hate it when LEOs break up student protests or enforce laws against minorities or immigrants. The politics on the right wing are pretty much a mirror image, perhaps a hate-love relationship: while they are typically anti-government including against law enforcement (see above, where a right-wing user openly espouses breaking laws, which implies he wouldn't like laws to be enforced), they are also very much pro law and order, with "back the blue" and blue line flags.
But no, police unions don't just go shopping at the State Capitol for the laws they like to have. On the contrary: make friends with some state law enforcement (CHP or Park Rangers), and they pretty uniformly despise the legislature for screwing them over.