Being a generalist is a lower risk strategy than being a specialist from a portfolio management perspective, i.e. investing how you spend your time.
If you specialize in something and it stops being relevant you might have little marketable skills to contribute. This would be like putting all the eggs in the same basket.
If you are a generalist you are protected from such a scenario since you put the eggs in several baskets.
But as a generalist you might be missing specialist opportunities so, of course, it's a bit of a tradeoff.
In this sense, it can be rational to be a generalist. However, every person's experience is unique so it's hard to say that one thing is better than the other without further context.