Be quick to adapt and learn. Whatever field you enter is going to look completely different in 30 years (if it even remains), so if you can adapt quickly and learn whatever skills are newly relevant, you’ll be in a decent place. In most employers there’s a large barrier to hiring someone new, so if your field is becoming irrelevant / automated / transformed, but you’re able to start doing some of the new work that your employer needs doing, then your role will grow to encompass that work and you’ll remain relevant and valuable to your employer. By adapting and picking these tasks up, you essentially can rotate out of irrelevant skills into relevant ones while keeping your job and seniority.
I’m not sure how AI affects this, but going with the “adapt and learn” of the previous point, focus more on having a lot of general skills rather than getting really investing in a few specific ones. Most jobs aren’t going to be pure <field>. In my career so far (I’m about a decade older than you for what it’s worth), I’ve differentiated myself from other statisticians & data scientists by also being strong at software development. My classmates from where I did my master’s are better statisticians than me, but they’re limited in what they can do because while they can develop a great model, they struggle to get it running well in a production environment. That limits their employability. I, on the other hand, had no problem with that and was able to have great success at my previous employer. I was then able to leverage that particular experience / skill combination to get my current job, where my employer was explicitly seeking only people with this combination of skills (and struggles quite a bit to find them!)
I would suggest focusing on developing skills that are complementary to whatever field you enter.
It’s hard to say what AI will look several years from now given how fast it’s changing, but so far I’ve noticed that its outputs can be either okay or very awful, and only someone who understands the field of that output can tell which of those outcomes it is. That’s why experienced programmers who use AI for coding are able to get some value (they filter out the awful output), while people who don’t understand coding ship slop. Ditto for other fields. Going with the “be okay at lots of skills” of my previous point, I suspect that this would help you get more out of AI than most people as you could more effectively filter out bad AI output in a variety of areas, which could give you a leg up.
Tl;DR always be learning new skills; focus on quantity over quality.
Tl;DR always be learning new skills; focus on quantity over quality.