Building a new thing from scratch means there's no guarantee anyone will ever use your code. The idea could be crap, the need not there, etc.
There's satisfaction in taking a page that was taking 10secs to load and making it load in 43ms. You know you've had a big impact on the thousands, 10s of thousands, etc. people who are using it.
And building a new system tends to go to the crap programmers because people are price sensitive. It's not until they start seeing the problems that expensive programmers turn up.
I met this game Dev contractor once in his 40s, he was complaining how he never gets allowed to make a game, they get the inexpensive graduates to make the game, then parachute him in at the 11th hour to "optimize" it, which is basically tidying up the pile of shit the inexperienced Devs made.
Yes but I would have more fun coming up with it in 43ms in the first place. No need to artificially benchmark yourself against an old version of code. The market is the real benchmark - without the baggage of recode.
re crap programmers - I don't doubt that this kind of behavior exists, and certainly with the success of the games industry and the extremely low barriers to entry (unity/unreal/steam/app store etc), this behavior may even be commonplace.
If I was you I would have advised the senior dev to find another job. A company that operates like that is looking for code monkeys, not professional software engineers, and any such professional software engineers won't hang around for long.
Make no mistake, if you hand me a smashed LEGO tower and ask me to "fix it" (and pay me to do so), then I'll definitely take some creative liberties along the way while rebuilding it.