I've worked both in early stage startups and in companies that are established and are still using their original startup code base. I've seen some terrible design decisions coupled with quality code that survived 15 years because the company had amazing market fit. It cost the developers a lot of extra time to work around the poor design decision, but the company was profitable enough to make up for the dev cost. That's the most common situation I've seen. The best codebase I've ever worked with was beautiful because the company had long lead time on sales(avg deal took 12 months) so the developers had time to refactor as needed. This company is still alive, so I consider them a success!
The other factor in code quality + business success is team size. With a big team and poor quality code, it spirals down much faster, each new bug/feature gets harder and slower to implement. If its bad code but its always the same 2 developers, they will be consistent enough in their own styles that the code base will not degrade nearly as fast.
You like the food from a particular restaurant. Does it really matter to you as a customer, if the chefs were home trained or went to a culinary institute, whether they wing it or follow detailed standardized recipes?
Bad code quality may be a symptom of rapid iterations and not burning too much cash on development prior to achieving product-market fit. Ability to rapidly iterate and having enough cash to continue operating would both increase chance of success.
On another hand, it could be possible to have glacially slow iterations while burning truckloads of cash and still have low quality code. E.g. hiring an unnecessarily large team of high-priced developers who are not competent, or trying to operate in the context of some existing complex legacy environment that impedes rapid iterations and delays feedback signals.