New technology often replaces old technology, but new theory (in math/CS) generally extends older theory, and problem-solving techniques are often timeless. So if you're looking to learn things that will be relevant in the long-term, your answer is likely algorithms, data structures, and the like. They're not going to be rendered irrelevant by the passage of time; they're going to become more fundamental as we build more advanced theories on top of them.
If the kind of stuff you're into is more like Rust, React, or whatever, then the stuff useful 50+ years from now probably won't be those particular technologies, but the ideas behind them. So instead of learning Rust, you'd need to learn about topics like abstract interpretation and formal verification. (Or to put it another way: try to figure out how to make a Rust compiler, vs. learning how to use it.) If you're into event-based technologies or like parallel programming, go learn about the various models of computation (there are lots) and their strengths and weaknesses. There's a lot of prior literature and research in areas you might not expect, and you'll be surprised how often research from half a century ago suddenly becomes relevant again (like it did with parallel computing). If you like PyTorch, go learn about optimization and machine learning (and I'm not referring to neural network architectures here). There are grad courses on all of this stuff if you go searching around. You'll probably have to put in more effort into them than you'd need to put into learning React or Go, but that's life.