When should you rewrite your SaaS from scratch vs refactor what you have? A practical framework for founders facing a broken or slow codebase.