Because now other employees have no motivation to put in anything more than mediocre work. The reality is people are motivated primarily by self interest. If advancement and retention is based on seniority rather than merit, people have no incentive to put in more than the minimum work.
This is assuming they were already based on merit and not on nepotism and favoritism. In comparison to those, seniority might be a reasonable alternative.
Competition will bring success to the company that fosters an engaged and motivated workforce. Even in national unions, they are still subject to foreign competition.
Sure, the free market isn't immune to nepotism or favoritism. But unions more often than not institute practices that give the same rewards to mediocrity as excellence - to the effect that the latter either put in less work or change jobs.
In either case the company risks losing to a more focused company valuing meritocracy and contribution over either nepotism or seniority. And we see this happen when starts rise up to the top. But our current system gives a lot of protection to existing players, be it through regulatory capture or be it through more natural phenomena like brand recognition taking time to decay even in the face of numerous bad products (in the world of games, look at how many people are still looking forwards to TES6 despite the issues with FO76).
There is also some cases where valuing meritocracy is only the best option when employees are willing to leave, but many employees are very stuck to their existing jobs. This is why pay raises do not keep up with the price of new hires. Consider the case where the cost to hire a new employee goes up 6% year over year while the company raises go up 1% year over year, potentially losing out to even inflation. The reasoning is that the extra costs to hire the few people who leave to another company to capture the 5% difference is smaller than the 5% savings for each person who does not leave.
To some extent, unions help to balance out the issue where most people are not perfectly rational actors.
Everything is a trade-off between priorities. You can optimize for anything, but not everything.
There's nothing "wrong" with stable employment for unproductive people, but when you optimize for that as a goal, then you're paying for it with things like decreased productivity and immense frustration for the creative people who actually want to solve problems. Detaching employment from productivity reduces it to ritual, which is incredibly demotivating for the good workers who see through the farce. They can't even go off on their own to volunteer their skills for the common good, because they still rely on employment--but their hands are tied within that sphere due to a fundamental distortion of its meaning.
The current system was designed at the beginning of the Industrial Revolution for factory labor. Instead of pretending that we can force it to be relevant into the future, we need to accept that productivity is moving into the realm of cognitive work. Part of this means educating people from the ground up to use information tools and reason abstractly, but we also have to admit that not everybody is going to have the innate ability to contribute in the future, and handle that in a way that doesn't hamstring the people who can.
What's wrong with "mediocre" employees staying employed?