The airlines are in the trouble they are in because they saw it as expedient to deny Covid exists. (Hard lobbying for an end of mask mandates on planes)
Covid, alas, did not do them the favor of agreeing to their belief system and is still around. And so now they have a large number of people sick, and a large number of employees upset that their health is sacrificed for corporate profits.
As for "why don't they just hire more", pilots don't grow on trees. A commercial licenses requires 1500 flight hours, spread out over at least two years. And (again, because it was cheap), airlines outsourced that cost to pilots. Same as all other education efforts. So, on the pilot side, addressing a shortage takes at least two years and requires finding a bunch of people willing to sink time and money into a license - while simultaneously the airline companies have sent a clear signal they don't care about their employees.
"The market" can't fix those issues. Not in the short term, and with the trust lost, not even in the mid term.
So why didn't airline cancel those flights? One, if you pretend the situation is different from reality, the pain of cognitive dissonance makes you buy into your own lies. Two, even if you resist that force, as a publicly traded company, cancelling thousand of flights in advance is a hit on your stock price. If you wait until the last moment, maybe something changes, or you might make it at least past bonus day.
Ultimately, the market has adapted. It just has adapted to maximizing executive pay.