That's not actually how things unfold when a company gets into trouble. Your scenario is the perfect, idealized, never-happens outcome. We have dozens of historical examples at this point, from elite, massive corporations unraveling: what they basically never do, is the strictly rational idealized scenario.
What actually happens is closer to chaos loaded with self-interest and stupidity by management and the board.
The board gets attacked aggressively by large investors. Existing management and the board goes into bunker war bribery mode.
The board bribes shareholders, further depleting its cash position. See: IBM's most recent idiocy as their revenue melted for 23 straight quarters, while they continued to buy back stock aggressively.
The cost of their staggering $100+ billion in debt climbs over time as their financial and earnings situation erodes. By the time a serious problem erupts, they'll probably have $200+ billion in debt (they'll have that in just four or five years now), continuing their existing mistake.
They intentionally avoid paying off all of their debt while they can, to hold onto the cash (because hey, debt is cheap today, forget about tomorrow, tomorrow is valhalla and rainbows), which they then make the mistake of expending to bribe shareholders as the stock plunges. Because, you know, things are going to turn around any day now.
Then they end up with less cash than they have debt, and down it all goes from there, in a spiral they can't pull out of.
If we're talking about what happens in a bad scenario, that's more like what commonly happens in reality. That net cash position will not be preciously saved to protect employees, the employees are the first ones to go. That net cash will be used as a bribery slush fund.
Their earnings haven't increased in years. They're facing a zero growth future, if only because of their immense size. The smartphone market contracted by ~9% in 2017 (-16% in China). They're facing a PC market scenario, where consumers start replacing devices a lot less often (while simultaneously smartphones face increased competition from all sorts of cheaper AI-focused devices). Their cash accumulation is far slower now than it was in the past, because it's all going to shareholder bribery. Meanwhile, they've added $50 billion in debt in about two years, with that pace continuing in the latest quarter. Their income to debt ratio has been eroding for five straight years.
Consider: right now Apple is making the incredibly foolish mistake of aggressively buying back stock with their capital, while its AI efforts are an embarrasment and they get their ass kicked by Amazon. Spend $50 billion catching up in AI etc? Or buy back stock? Apple has made its choice, and it shows.