I often ask my students if they prefer to write new code or maintain existing code. Ok, it is a silly question. Most people say they rather write new code, not just because it is more fun but also because it seems the worse bugs show up when we try to modify existing code to meet a different purpose than it was originally intended. Since senior developers tend to prefer working on new and exciting projects, it is often junior develpers who get stuck maintaining existing systems.
I heard a long time ago that Sony was experimenting with a practice of having their new hires fresh out of engineering school work on their new products and their senior engineers focus on redesigning existing products. Looking at the mountains of legacy code that most of my clients have and knowing it is often their critical assets I wonder if we should do something similar and try harder to make legacy code more manageable.