Thanks for elaborating some more.
I think this is a situation where there’s more than one right answer.
I never sold a startup for millions, but also have invested prudently over a couple of decades and never suffered such extreme losses as you describe. In fact, as I mention elsewhere, I decided early on that I didn’t have the time to learn how to pick individual stocks in a way that would be very likely to outperform the market, so I found mutual funds that are run by people who have the knowledge, expertise, and analyst support to do that on my behalf. As a result, my investments outperformed the S&P 500 by about 1.5% annualized over the long term.
Getting back to what you describe, yes, if you can afford to knock out your mortgage in a few years, that may be the better play, to have the greater flexibility and capacity to take on (prudent) risks in the years and decades that follow.
If you can’t do that, and can only add say an extra 0.5 to one monthly payment per year, your mortgage will still be there in 20 years, so I still think my advice to invest that extra money is solid for people in that, more common, situation.