In my work we have to type of projects. Those that have to be durable in time, in which we use vanilla php, vanilla js.
Also we have projects that are "efforts for one year", in which we use frameworks like laravel, symphony... And others.
Our experience is that frameworks have, in general, a bad tendency to "rewrite everything and make it incompatible with older versions". Our very first deception was a library called YUI2. Now our deception is called "older version of laravel".
Only codeigniter has passed the "age well" tests!
Frameworks went and go. You can learn framework X very well, but this will kill you in no more that 3-4 years.
Learn vanilla and you would be able to do relearn anything quicker and easier that if you just "learn to use a framework"
It depends on the culture of the language community for the most part. In Java community there is always the care to make things compatible to older versions in Java language itself. It is rare, as far as I know, to have any serious problems when you update from one version to another, although caution is always necessary. For frameworks, the same mindset generally applies, at least for the major frameworks I generally use, Spring at the top of the list, it has 15 years and I think it aged well. In Java there are many standards that are just implemented by various frameworks, so jump from one to the other is not very hard.
I don't see Spring going anywhere as far as web development goes, but if another new shiny framework comes, it will not be very hard the transition by what I know of how things work in Java.
It's not the framework's fault that you have to rewrite everything.
You can take measures to make the framework replaceable. Some frameworks make this a little easier and safer and some make it a terrible experience (read: ActiveRecord ORMs) forcing the team to write a lot of code to protect the application.
However you bring up a good point that not all applications need to be built framework agnostic. If the lifespan of an application is one year then it's probably a lot more cost effective to just go with framework's best practices. But is it easy to say how long the lifespan can be? 🤔
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.