Are undergraduate courses grades matter, if one change major in graduate schools? Suppose a physics undergraduate student wants to change their major to pure/applied mathematics in graduate school.

The student has already taken few courses in mathematics (suppose Introduction to Complex Analysis, Introduction to Real Analysis, Probability Theory, Advanced Partial Differential Equations) and is doing fine but no A's grades, only B's and B-'s grades, for the mathematics courses and at overall (for every physics and mathematics courses that already taken), the student has upper second class grade (3.3-3.6 grades from 4).

How does the graduate school see this student, given the student really shows interest in mathematics and has at least one publication or attended a pure/applied mathematics conference once as presenter?
If you haven't taken any pure math courses, you are very unlikely to be accepted into graduate school in pure mathematics. How can you prove to the school that you know the stuff they expect incoming graduate students to know? (The first courses in real analysis and abstract algebra, at an absolute minimum.)

If you have taken pure math courses, then you will have grades in these pure math courses, and these will be taken into account by the admissions committees.

If you have A's in your pure math courses and B's in your physics courses, then likely the admissions committee would weight the grades in your math courses more heavily.