No, that's what the line of credit is for.
Maximizing your savings/investments isn't a bad approach when your young as every $ made ads cumulative value over time. I wouldn't recommend it when you have a family.
If life were 100% predictable, and I never had to worry about a sudden expense, or a bill being higher than expected, or gas/grocery prices rising, then I'd totally be down to invest my entire net worth and live off of a portion of my paycheck, maintaining minimum balance in my checking account, and sweating bullets whenever the market dips.
I went through several weeks of unemployment last year while I was between jobs. I was fortunate enough to receive the covid+standard unemployment payments, but still had to supplement that with cash from my savings to skim by. The alternative would have been to break my lease to live with my parents, incur bad credit, potentially have my car repo'd, etc. It would have set me back several years, and wrecked my self image.
Since the demand for programmers has always been good wherever I've lived I've always opted for higher paying contracting gigs since I was never concerned about job security, i.e. before kids, I'd most likely be more risk averse and look for permanent roles after starting a family.
After I paid off my mortgage my expenses came down and after saving ~6 months of living expenses (easy w/o rent/mortgage) was able to take the leap to quit my FT job and go off on my own to create a commercial product which I worked on tirelessly until achieving my financial independence goals.
I still have some student loans, but am quickly approaching/may have already reached Zero Net Worth(hooray!) when everything is totaled up. Buying a house would be a smart move, but I'd rather hold off on that to let the market cool down, and try to find a partner who would share it with me.
Imagine, market crashes 50%, you lose your job, and what? Are you going max out your cards with 20%+ APR? Are you going to realize your losses?
Emergency fund is there to help ride out bad times, so you don't have to take shitty jobs, realize losses in your investments, sell your home or not undergo medical treatment due to financial stress.