I'm a self-taught spaghetti coder webdev with thirteen years of beginner experience; mostly learning by googling how to do everything as I built web apps for small businesses or wired up forms and APIs through agencies. It worked for a long time, and yeah I'm probably that guy who wrote that stinky codebase you're dealing with. I'm not particularly proud of that.
Anyway, my "skills" (heh) seem to be mostly irrelevant now. I hated frontend ever since the responsive era, but I got by sticking to less design intensive stuff. These days the web is evolving very rapidly and I've kept up sorta, but I'm not passionate about this field, I'm getting older and there's lots of competition now and I'm unemployed. I basically want to get as far away from Node and React and CSS as possible. What's a good path out?
But if you think a break in another domain would just magically make everything better, try becoming an expert in some obscure domain in some not-well reputed company. There most of your work will probably end up be muttering a few words in meetings and drinking coffee, with no one to tell you what to do as they dont really understand your domain.
There are a lot of codebases with really bad code that no one wants to take care of, so findind a gig like that would probably also pay you well.