"Fortunately," hardly anyone in Silicon Valley plans to be working on the same codebase in a few years. There's a good chance the problem space won't be relevant anymore by then, and on the off chance it's still funded, the new team will rewrite it whether or not it's good.
>sprints are too short for devs to sneak refactoring into the schedule.
As I've gotten more senior, I've just gotten more brazen about doing this less sneakily.