1. What you like doing
2. What you are good at doing
3. What people will pay you to do
For math, if your goal is to prove something that no one else has proven, then all three are under attack.I think the "egoless" path is taking a 50,000-foot view of mathematics that ignores the above lens. Sure, mathematics will survive and even prosper with AI, but what about the mathematicians?
In time, the profession of mathematics will evolve so a new task is at the center of the diagram--maybe it will be explaining math results to humans or teaching math to future mathematicians. I don't know. But it's easy to see that not everyone is going to be happy with the transition, and many will be left behind.
For software engineering, it depends on what your center is. If you like "writing code", then #3 is under attack. But for those whose goal is, "make something work", all three are still viable and even better than before (or at least faster).
That's why we see so much disagreement on HN about whether AI is good or bad for software engineering.
I'm sure lots of other people have made this observation before.