I'm in my 60's. Have worked as a contractor in effectively every field of IT and taught post-grad SE courses at university. I still program in C, Javascript and Python. Can design, build and configure data centers. Know most variants of Unix and its progeny, etc, etc.
Yet ... I'm finding it very hard to get contract work post COVID. Recruiters are looking for 3-5 years experience with specific products. I demonstrably can learn fast and most of IT is old wine in new bottles with fancy labels. But that doesn't meet expectations.
If you seek intrinsic motivators, then being a generalist satisfies curiosity and yearning for knowledge. If you seek optimum employability and high salaries then being a specialist is the key. BUT a lucrative specialization now, will probably be of little value in 5-10 years time.