Not necessarily. I was a web developer for 24 years, then my company moved me into an integration role (it opened up at the same time a website project I had been working on closed down) - I haven’t touched anything web development related in a year or so now and have been doing straight Java, Python, Apache nifi, AWS, etc system integration programming. I’ve found that I enjoy and could continue doing this for years to come. But, I also could move back to web development pretty easily.
Right, but I do integrations for a few more years and I can now look for either web development or integration jobs. I now have at least 2 career paths. Though, I've spent so many years doing database work (both DDL and DML work) that I could do that as a career path too. Frankly, none of these things are where I started out as a junior developer.