In my 30, or so, years working as a programmer, I have changed jobs several times. And when I say changed jobs, I mean different employers in different industries using a different tech stack, so really changed.
Switching jobs makes you worse in the sense that your corporate knowledge - local source code, local program design, local tools, contacts, etc - is now worthless and you need to replace it. That takes time to learn, and learning it will slow down your productivity.
Switching jobs makes you better in that you learn a new tech stack, new techniques, new concepts (design, how to work with clients, how to think about problems), etc.
Whether you switch jobs is somewhat irrelevant. In our industry, you need to be learning new stuff. If you cannot sit down at the end of a year and list a couple of significant things you learned over the past year, you've got problems. The industry is ALWAYS changing. You cannot keep up with everything, but if you don't grow, you will become obsolete. the good news is that it's never been easier to learn new stuff.