The best orgs do a rewrite usually in the face of sea changes to the technology stack (e.g., containers vs. VMs) or business use (number of users is now 10X of original etc). Bringing key infrastructure in-house is also a decent reason, but the benefit of building expertise in an existing ecosystem vs. full rewrite should be carefully weighed.
You probably have read spolsky's article. It's quite dated by now, but it's still more right than wrong. http://www.joelonsoftware.com/articles/fog0000000069.html
When I start a rewrite I check which are the essential features and try to iterate my way to 100% (sometimes the 100% aren't even needed) with many small releases, but every executive fears "rewrites" like the devil....
But I have the feeling, that a prio-list of the needed features is all that is needed.
People say what they need, you implement it, done.
I mean the way other companies steal your customers IS that they implement a better version of stuff you did. So it's either, they do the rewrite (in their case a first write) or you.
Eventually, it's just better to start again.
For example, right now I'm rewriting something that is currently a PHP program that executes a Python program that runs one of three binaries or calls a REST API and posts results back to another API into a single program.
Just makes sense: easier for developers to maintain, better for SRE to manage when deployed.
Far too often, code grows stale because nobody wants to work on it anymore. Every change is stressful because it could break something else, which means more time wading through unfamiliar and unpleasant code. So, the maintenance programmer patches it with silly putty and duct tape as to not bother any other portion of the system.
A few years of this and it becomes brittle.
If we have a decent suite of tests, however, we can have an application that doesn't need to be rewritten because the maintenance programmer can attack a problem with the confidence that they haven't broken anything else, and so can make the right solution rather than the least invasive solution.
I have worked in a few companies and such behaviour almost never happened.
The management always wanted to maintain the old stuff and only resorted to a rewrite, when things were really really bad. "We don't have the time/money" was always the reply. But I had the impression, that a rewrite wasn't that expensive, it always went faster than the first version, without many bugs the first version had and a better structure.