The biggest risk to building a startup isn't "can I build this thing" (feasibility risk). It's "will people even care if I build this thing" (value risk) then "can I do it in a way people use" (usability risk). Patents help solve business risk, but that's generally considered to be the 4th (and last) of the risks.
There are exceptions where patents do need to be filed first or the business viability dies. However, I generally assume that if you've addressed value, usability, and feasibility risks to create something truly meaningful, your competitors will find a work around to deliver the same value, usability, and feasibility without infringing on your patent. Thus, patents, are nothing but a minor inconvenience. In some cases, the public filing of a patent, can give your competitors a leg up on competing with you.
I would start accumulating patents at a gradual pace at around $100m ARR in preparation for IPO, assuming that you feel that is in the cards.