The point of a union is not prevent layoffs and role reduction in force. It is to make sure that the company has done its absolute best to find another solution to the problem (that they're trying to solve with layoffs) and ensures that the company is accountable for all their decisions.
This just limits hiring in the first place as we see in European branches of (generally, American) tech companies. And regardless, what solutions can be found by the union?