This is a very common theme with labor laws. Most people are very, very bad at predicting second- or higher- order effects of a regulation. If the market encourages some behavior one doesn't like (like firing people), it may be the case that one is simply too myopic to comprehend whatever large-scale stochastic optimization the market is doing, and what's going to give when one stops that optimization from happening.
As a result, many (most?) well-meaning market restrictions end up hurting more than they help, often in indirect and difficult to quantify ways spread out over thousands of different interactions. This (friction introduced by the inability to fire people who should be fired) is actually one of the easier examples to point to.