They may be replaceable but they are also capable of landing new jobs. Specialized people are far less replaceable but once the industry changes they’re SOL and now they have to go back to a fundamental level to learn something else. Pick your poison.
Follow your passion and get really good at it... generalists tend to struggle with growth until they get really broad responsibilities... generalists is not a way to escape being an expert. You have to be really good at something
By specialisation I dont really mean PhD. Apparently, industry experience in specific field eg. ML over years counts if wanna work in applied research or application of ML. For pure theoretical research, PhD will surely be helpful.