Most of the knowledge required to plan, develop and maintain a project is transferable to any another “kind” of programming or similar related job.
if, loops, functions and all other core operations you learn in web development will be mostly the same in any other kind of development, what changes most of the time is syntax and language-specific nuances.
Even if, as stated by @ronstarcool, something better is invented tomorrow the change might be fast but not immediate, people will need someone who understands their current platform (current developers) and is able to migrate it.
The closer you have in “recent” times of extinction of the “web developer” that I can remember on the top of my head was the .dom crash in the early 2000s and that was more of a market reduction in the demand and segmentation of responsibilities (webmasters were replaced by developers, designers, and a bunch other more specialized positions) than actual extinction.
If it makes you feel better, companies still pay, quite well, for COBOL and RPG (language with 60 years) developers and that’s a language that is mostly gone from most peoples mind.
It’s not what specific knowledge you have but what you do with it that matters at the end of the day.