I like doing what you describe as well, improving an existing codebase, but its not something most businesses see as valuable. Instead you end up adding more hacks on top of the existing crappy codebase to get features out on time, making it even worse.