I think the main point is when you say
you just want to rewrite everything from scratch
Just embrace it.
Use as many unit tests as possible, then let refactoring be a common practice.
Automated and unit test will ensure that changes will not introduce regressions; devoting a certain percentage of your time to refactoring old code (and this means, less new features!) ensure the existing codebase will not get old, or at least not so fast.