You're conflating two things (probably intentionally, but I'll go with it). If you are firing someone without replacing (a layoff), then presumably, that person cost more than the value they provided, and so laying them off should improve the value of the business (after incurring the costs the parent post mentioned).
If you are firing someone to replace them with someone else, you are incurring a lot of cost (hiring is time consuming, difficult, risky, and requires a ramp-up time before the new hire is productive), and hoping that the long term benefits outweigh that cost.
Based on that logic, layoffs should sometimes cause the stock of a company to go down, if the shareholders think those employees contributed more value than the company saves by laying them off.
In reality layoffs almost always cause the stock to go up. The market seems to think layoffs are an unalloyed good.
Based on my personal experience and general observation, it seems like companies are both slow to hire, and slow to fire. So, paradoxically, both actions seem like they should signal "this company is going to be better in the future", because companies only either hire or fire when it is really obvious they should.
> Based on that logic, layoffs should sometimes cause the stock of a company to go down, if the shareholders think those employees contributed more value than the company saves by laying them off.
You are treating short-term stock market movements as a signal of how well the company is performing.
Wrong etage. Stock value is not very responsive to the fact that some line manager fired two poor shmooks, but it is responsive to the news of company laying off two digit percent of the same. That will be of course corrected somewhat once fresh quarterly results will show how effectively those enlightened souls managed to oppress the work takers.
Now if your line manager fires somebody for no good reason and then has to still pay the salary of this person for a year and a half and also pay the salary of their replacement -- that, when accumulated, starts affecting bottom line at some point.
And since management is often paid in stock, they seem to care more about stock price than this "years of salary and paperwork" cost you mention.