It never fails to amaze me how little we learn from the past. I wish I knew if it was unique to software development or all industries suffer from this level of hubris.
IIRC EBay rewrote their backend three times. It was not because the previous version was wrong, but because they were growing and changing, so a new backend was needed anyway to tackle that. They were and are doing fine.
Twitter rewrote their codebase from Ruby on Rails (the endless source of fail whales) to a completely different platform, again due to the huge growth. Technology-wise, they are doing pretty fine.
Facebook rewrote Messenger from a very thick and complex client architecture to an outrageously lightweight and flexible architecture based on eventual consistency / roughly-CRDT approach. FB Messenger is doing very fine.
Never rewrite your codebase without a really good reason. Big wins in performance, maintainability, and ease of development may be good reasons, depending on your situation.
Rewriting a backend is easier, because you can use a Strangler Fig[0] pattern to replace it bit by bit. The customers don't even have to notice.
With a browser you really can't do that, because you can't force users to update and then you'd have a bunch of semi-working Frankenstein monsters in the wild. A full rewrite and release is the only option.
https://www.joelonsoftware.com/2000/04/06/things-you-should-...
https://en.m.wikipedia.org/wiki/The_Mythical_Man-Month