This is why we need unions. Layoffs are unfortunately, sometimes, necessary. But when they happen, it's important that the right people are chosen, for the right reasons (whether that's performance based, voluntary, protecting certain groups, ensuring fairness, etc). That requires collective bargaining by representatives who are able to assess and change the criteria, and who are able to negotiate for better outcomes…
They would be among the first to go under union rules, too.
Unions are often worse at prioritizing things like tenure over performance, if anything. But even under those rules she was one of the most junior people.
There is basically no situation where a union would have prioritized this any differently.