One benefit to unions is that they increase worker bargaining power over pay rates, but one cost is that their interest is defending the current workers at the expense of other people who don't work there yet. This causes trouble because union jobs tend to lock in senior workers, leading to it being hard for young people to break into the job market.

Perhaps we could directly restrict unions from making any deal that hurts people who might want a job in order to protect the people who currently have that job.

Perhaps unions should be prohibited from making any deal that protects current workers without allowing that worker to be 'swapped'. E.g. the union could make a deal that any person doing job X makes Y money, but they would not be able to prevent a person currently doing job X from being fired, provided that that person is quickly replaced by a new hire who is also paid Y.

Also, the unions should not be able to make any deal privilaging seniority. They could ask for deals increasing the average wage or median wage of some pool of people as a whole, but they would not be able ask for the senior people to be paid more or be more protected.