The problem was not the rewriting itself but the lack of understanding how things went wrong the first time. From my experience it is absolutely mandatory to have many deeply introspective and self-critical thought sessions to figure out how you got into the mess. Only if you have clearly identified what went wrong in the past, you will be able to successfully rewrite a project and avoid the mistakes.
For some of the products we did this and rewriting was a huge success. For some others we did not and the rewrite turned out to be just as terrible as the original version. Then we rewrote it again and it was still a mess.