Mathematicians can earn status in the field by solving previously unsolved problems. AI can do it too, arguably better than humans. This worries professional mathematicians for two reasons. One is the same thing that worries people in other professions such as programmers: If they are currently being paid to solve problems and AI can do it faster and cheaper they may no longer have jobs. The other is that mathematicians enjoy solving unsolved problems. Unsolved problems that can be solved by a sufficiently good mathematicians are a depletable resource being depleted by their AI competitors.
This gets us to the question in my title: What are mathematicians paid for? Solving a problem nobody else has solved gets you status, a job, very likely tenure, possibly a cash prize, but why? One possible answer is that solutions to unsolved mathematical problems are so valuable that mathematicians who have produced one are rewarded for doing so, mathematicians who have not produced one are hired in the hope that they will.
I find that answer implausible for two reasons. First, although mathematical breakthroughs occasionally turn out to have real world uses, most do not. Second, if a breakthrough does turn out to have valuable uses, the value does not go to the people paying the salary of the mathematician who produced the breakthrough. It might make sense for the NSA to hire mathematicians to do research relevant to better ways of making or breaking encryption and use the results. If a Harvard mathematician solves a problem, even if the solution is a breakthrough of real world value, he will publish it.
My explanation for why Harvard and other universities hire mathematicians is that they are producing something valuable, teaching students not new mathematics, the solving of previously unsolved problems, but old. Old mathematics is useful in a wide variety of fields, most obviously engineering but also computer science, cryptography, statistics, economics (where I suspect it is overused) and others.
There are two reasons work on the frontier of mathematics gets status for mathematicians. One is that it is evidence they are good at doing mathematics, one requirement to be good at teaching it. Similarly, universities prefer to admit students who got high scores on the SAT exams. Getting a high score on the SAT does not produce anything the university wants but it is evidence that the applicant has abilities the university wants in its students.
The other reason is that doing work at the frontier of mathematics is evidence you value doing mathematics, enjoy it, arguably another requirement for a good teacher.
In my view, the good teacher is not distinguished by the breadth of his knowledge, by the lucidity of his exposition, or by the immediate reactions of his students. His fundamental task is not to dispense information, for in this role he is incomparably inferior to the written word. His task is to fan the spark of genuine intellectual curiosity and to instill the conscience of a scholar - to communicate the enormous adventure and the knightly conduct in the quest for knowledge. (I realize that this view of the teacher’s function will strike many as austere. They will emphasize the need for sympathetic development of the utmost in each individual, and turn teaching into coaching. I think they do a disservice to mediocre as well as to good minds.)
To this end, the fundamental requirements of the good teacher are competence - how can the incompetent be other than slovenly? - and intellectual vitality - how can the sedentary excite us to bold adventure? These traits may be acquired by wide reading and deep reflection, without engaging in research and becoming a specialist. But it is an improbable event. It is improbable psychologically: it asks a man to have the energy to read widely and the intellectual power to think freshly, and yet to do no research. He is to acquire knowledge and construct ideas - and keep them a secret. It is improbable scientifically: it asks a man to be competent in his understanding of work that he has had no part in constructing. At least in economics this is almost impossible. There is no book that states the consensus of the profession on the ideas that are changing - and these are naturally the most interesting ideas. Only the man who has tried to improve the ideas will know their strengths and weaknesses. Scholarship is not a spectator sport. (George Stigler, Specialism: A Dissenting Opinion)
The reason Harvard wants to hire mathematicians who have demonstrated the ability to do work at the cutting edge of the field, to expand mathematics, is not that Harvard benefits by the expansion. It is that Harvard benefits by having smart students, potential students want good teachers, and the ability of Harvard professors to do cutting edge work signals that they will get them.
There remains one problem: If all the human-solvable unsolved problems get solved by AI, universities will no longer be able use the solving of a previously unsolved problem as a signal of mathematical ability. They will have to fall back on whatever signals they now use to evaluate potential employees who have not (yet) solved an unsolved problem.
My web page, with the full text of multiple books and articles and much else
Past posts, sorted by topic
A search bar for past posts and much of my other writing
A draft of my next book, Consequences of Climate Change, webbed for comments.

Is there any evidence that people good at solving math problems are good teachers?
For that matter, is there evidence that Harvard even cares if its professors are good teachers?
I think the part you are missing, which you touched on and then blew right through with "It might make sense for the NSA to hire mathematicians to do research relevant to better ways of making or breaking encryption and use the results. If a Harvard mathematician solves a problem, even if the solution is a breakthrough of real world value, he will publish it." is that the NSA hires more mathematicians than Harvard, especially the ones that aren't middling. The NSA and their ilk around the world hire the overwhelming majority of top tier mathematicians and the AI isn't going to replace them, at least not any day soon.