Mathematicians are in the same boat as Silicon Valley programmers in the end: AI is doing their job better than them and cheaper. Other professions will join shortly.
The question then becomes, what do humans do? Resigning to die quietly is hardly the most favorable option?
Just because somebody else can do something better than you ever could doesn't make doing it superfluous. There is more to mathematics and software engineering than finding proofs and algorithms.