(Quick note: I am not a math teacher. I am a CS teacher with a bit of dysgraphia myself. However, my insights here actually came from when I used to be a high school music teacher, where I was practically forced by the subject matter to tackle this problem with my beginning theory, AP Music Theory, and advanced theory classes. Also, there are some nice insights about dysgraphia here.)
I would have a number of these students every year. But musical staves are small, and the writing must be legible to be useful. (You can only imagine the pain of trying to sight-read at the piano, in real time, what dysgraphic students wrote for me!)
Most of the motor issues that I encountered were really cognitive issues. Students with really terrible writing did not understand why it mattered, and thus had never put serious attention and care into figuring out how to write things neatly when they needed to. They didn't really know how to write the letters of the alphabet, and (more importantly to me), they were incapable of simply looking at my treble clefs, or my eighth notes, or my quarter rests, and organically figuring out how to imitate them.
As a result, I actually created worksheets, much like we all got in early grammar school, with every key symbol broken down into small, instructional writing pieces. (Treble clef: First draw the dot on the second line. Try it three times here: Then, make a quarter loop up to the third line like so. Try it three times here: Now, continue the loop down to the first line like this. Try it three times here: ...)
Breaking down how to write the symbols into tiny steps this way was absolutely tedious, but paid off handsomely for me in all of the cleaner writing I received.
For students who needed extra help, I would sit down with them, explain why handwriting mattered in this context, and ask them to copy a page of very nicely done work by another student, with attention paid to making everything precise and neat. I gave them a small amount of extra credit for this work. I didn't mind providing this, as I was asking them to do extra work.