Two things: One, if you don't like the work assigned to you by a job, it's time to find a new job. There's no other way! As long as you fill that role, you'll be working at the behest of your employer, and although you can try, changing the distribution of work you get is ultimately beyond your control.
Second, working on legacy codebases is one of the most challenging things you can do as a SWE, you're in a maze where the walls are Chesterton's fence. I just left a legacy codebase to write a new app in NodeJS. Granted, it was a lot of work to get up to speed on the ecosystem and carefully decide how to set things up, but the CI is blazingly fast, and the complexity of the same feature in the new codebase might be 10x less, at least for the beginning. For example, in the legacy codebase, adding pagination to a route is a PR that touches 25-30 files. Yes, there are anti-patterns involved, but for the new app, and it's in Haskell, that same functionality can be done in a greenfield project much more effectively.
Of course, everyone wants to work on greenfield projects, make the architectural decisions, and build software without the constraint of past decisions weighing us down, but adding features to and improving legacy systems, IMO, is just as valid of a skill. Good luck navigating this.
Second, working on legacy codebases is one of the most challenging things you can do as a SWE, you're in a maze where the walls are Chesterton's fence. I just left a legacy codebase to write a new app in NodeJS. Granted, it was a lot of work to get up to speed on the ecosystem and carefully decide how to set things up, but the CI is blazingly fast, and the complexity of the same feature in the new codebase might be 10x less, at least for the beginning. For example, in the legacy codebase, adding pagination to a route is a PR that touches 25-30 files. Yes, there are anti-patterns involved, but for the new app, and it's in Haskell, that same functionality can be done in a greenfield project much more effectively.
Of course, everyone wants to work on greenfield projects, make the architectural decisions, and build software without the constraint of past decisions weighing us down, but adding features to and improving legacy systems, IMO, is just as valid of a skill. Good luck navigating this.