You don't have to work in the same research discipline for your entire career. Indeed, at least some drift is probably the norm, if only because most problems don't warrant 40 years of attention. But researchers tend to be very focused and dedicated to their subject, spending many thousands of hours exploring it and communicating their findings to the world. They become known for it - "Susan the cosmologist", "Steve the mouse guy".
But it doesn't have to be that way. You could change disciplines.
There are a number of pros to this. You learn a lot of new things when you change discipline. Not just the facts and figures of the new subject (although there are many of these), but also you find out how people in that discipline approach scientific research. How do they collaborate? What are their conferences like? How do they write their papers? All these things can be surprisingly different from subject to subject, and you can learn a lot by seeing different ways of making these things work.
All this new knowledge is stimulating. Not only is this a great experience for the knowledge-hungry academic, but it's a great way of generating new ideas. Perhaps there are problems in the new subject that are much more tractable using the old subject's mindset. Or perhaps you had a general problem you'd been thinking about, and an idea known about in the new subject gives you a "Eureka!" moment.
You can also act as a vector for good ideas flowing between subjects. This is why interdisciplinary work can be so valuable. When the good ideas of two different disciplines mix, sometimes you get important new discoveries. Being the cause of this is obviously a Good Thing.
Sometimes, moving allows you to find a better niche for yourself. There are all sorts of reasons that determine how well you 'fit' in any job and research is no different. Do the day-to-day tasks suit your temperament? Are you happy working on decade-long projects, or is six months a better timescale for you? How well do you gel with the culture in a given discipline? How well does your particular set of research interests fit into a particular discipline.
Depending on the specifics of the change, the practicalities of funding might become easier. One good reason for moving disciplines is to move from one where there's little funding to another that has much better support. I don't think this should ever be the primary reason for moving (and I don't think most scientists do research for the money!), but all other things being equal, wouldn't it be nice to not have to worry quite so much about where the funding is going to come from?
It can also be the case that changing disciplines freshens things up for you. Working on the same small set of problems for a decade or more can get quite same-ish, so moving on to a new set of challenges can open a wellspring of enthusiasm.
A well-judged change of discipline can be a great move, but of course it's not without downsides. It take a big commitment of time and effort, because there will be many new things you need to learn and you'll likely be moving jobs at the same time, so there will be the normal upheavals that this implies (you might even be moving house or moving to a different country). And you'll stay junior in your career for longer. In your new subject, you'll be a rookie even if you bring a lot of relevant skills, plus you won't have a network of contacts and collaborators yet, so these will need building. And your publication list in the new subject will need time to develop, before you can start applying for fellowships etc. None of this is to say that change is bad; simply that there are costs associated with a change this big.
In conclusion, there's a lot to consider if you're thinking about changing disciplines. And rightly so - it's a huge commitment. But if you make the right change, there can be a lot of benefit. And here's one more thought: Maybe the modern scientist should always be looking to diversify?