I once lived through a complete application rewrite. The rewrite was necessary to add a new feature that didn't fit into the existing code organization. We were able to reuse large parts of the old code, but it still took twice as long as estimated. And the result was the most bug-ridden version of the app ever. But ultimately it was successful, and the new feature was much loved.
And again: it depends. I was involved in at least one rewrite where large sections of the original code were incomprehensible, and rewriting the whole thing from scratch proved a massive success.
Which is just another example of Chesterton's Fence: https://en.wikipedia.org/wiki/G._K._Chesterton#Chesterton's_...
I once lived through a complete application rewrite. The rewrite was necessary to add a new feature that didn't fit into the existing code organization. We were able to reuse large parts of the old code, but it still took twice as long as estimated. And the result was the most bug-ridden version of the app ever. But ultimately it was successful, and the new feature was much loved.