I take a job at a small place. I'm a generalist, but they're cool with that. I'm there for a while, and the place grows. They need specialists. But in that time, I have become more of a specialist - learned more about the company, the environment it operates in, and the particular task(s) I am doing. Maybe I've been doing five things, and now they need to break up that work among five people. Fine, but I'm likely to be the leading candidate for at least one of those five slots. Even if it takes some training for me, that may be cheaper and faster for them than finding someone outside who knows how to do that exact thing.
That may not answer your question. You may be asking: "I want to remain a generalist. How do I do that in a world that keeps trying to drive me to become a specialist?" If that's the question, the answer is to either avoid places that are growing, or to keep switching to jobs that are earlier in this process - to places that need generalists.