It’s about balancing risk management and wealth. That balance is going to be different for everyone, but you always need to be a little cautious.
Have a little bit of your emergency fund in each of these.
Like, my whole department got let go not long after Covid hit. Had I kept my savings in stock, I'd have sold them at a major loss, because stock market falls and job losses tend to happen at the same time. By keeping some savings separate, you can decouple these things, to an extent. You don't want your emergency money to rely on a good economy.
And you need to compare that loss to what you would have had if you sat on cash for all of the time leading up to the crash too.
I'd be willing to bet keeping it cash would have been worse in most cases (depending on specific amounts and time frames and monthly expenses).
Get out of debt. Build an emergency fund. Start investing. Then re-think your emergency fund strategy if you really want.
In reality, your rent/mortgage and other commitments would continue to fall due at a very predictable monthly schedule.
So you sell down only as your liabilities fall due. The majority of your holding stays invested so you can capture the rebound over the following months.
This is an assumption that some people might say is unreasonable. There have been many times in the past where the rebound takes years.
Although, one might be able to make the case that the political winds have changed to ensure the rebound happened in months. But it’s still a riskier assumption than assuming a rebound in a few years.
Other than that you're right. Maintaining an emergency fund is expensive in term of opportunity cost. Like the cost of any insurance. There is no free lunch.
Sitting on tens of thousands of dollars of cash (six months of income!) in a zero interest rate environment is a mistake that really compounds over the years -- to the point of a few $100k in lost appreciation over your career.
Equities are no longer hard to turn into cash in an emergency. You can pull money out of your investment account the same day using a debit card if need be, no need to even sell your equities.
Keeping access to credit, but not using it unless it's needed, is the better plan. But after several years of saving you won't need it anyway.