Criteria for a Pure Math teaching job at a university
In the US it is possible to get a tenure track position in math fresh out of a PhD program. Having the doctorate implies that you have done some significant research and have at least one publishable work. But most doctoral students in math here also work as TAs along the way, so they have at least some experience working with students. Some are permitted to teach low level courses with only minimal supervision. So, that is the minimum. Your grades were pretty good also, if you complete a doctorate.
But in most cases a job being offered will have many applicants, meaning that the competition can be quite strong. Thus, if you are better on any or all of the scales you suggest then you have a better chance to actually get the job.
But personality also matters, which is why applicants are interviewed before hiring. It isn't considered to be just a paperwork process or a spreadsheet algorithm.
If you are a student in a doctoral program and want a teaching position in the future, find a way to TA, and, if possible, teach one or two courses in the department.
But it will still be the letters of recommendation you get, about both teaching and research, that will make or break your chances. Do a good job and get recognized for it.
To answer the second half of your question, grades are of very little importance in hiring faculty.