Doesn't matter. It's the rules, and he should be behaving during the test, and once he does, there won't be any deduction. You could try convincing the school to change their policy, but I would direct the energy telling your son he needs to change his behavior. I would be adding consequences at home for misbehaving and getting the deduction, not just leaving it like the school did all the work. Being a good student is every bit as difficult and important as knowing the information. It all helps give him self control skills for the future. My kids aren't there yet, but it was very hard for me to behave in school, so I'm bracing myself!
-Just saw your update-as for the wisecrack about him being immature-sure, say something to the teacher about it. But you're still seeing this as all completely unfair to your son, when in actuality, he was not behaving. My teachers said all kinds of things to students who were acting up-in those days, they didn't have parents questioning the validity of everything on behalf of their kids like now. No harm was done by the teacher's comment, she was probably ruffled by your son's behavior, but by all means, let her know not to do that in the future.
My daughter recently got a "less than excellent" mark for class behavior, and when her teacher told me she had been "getting sticks taken away" (reward system they use), it was like she was afraid I was going to be mad at her (teacher) for it. I asked exactly what my daughter was doing, and she said, "Just pushing boundaries, it's normal at this phase and age (she's 4 in K4) that kids push boundaries now that they're comfortable in class and around each other and sort of copying the trouble makers...I said, "No problem, thanks so much for telling me and please let me know how she does going forward."
Believe me she got a "serious" talk in the car about respect in school. She was calmly and firmly told by her father and myself exactly what would happen the next time we heard she was not trying her best to respect the class. We let her know we had eyes in there and would be talking to the teacher to make sure she was being polite. Needless to say, she has gotten "extra sticks" for good behavior ever since. Was I really upset about the behavior? No. But she has to feel like we feel it's important and that her teacher is a valuable authority figure to set our daughter's school behavior going forward.
I think at this age, tying it all in is great. Later, when he's older and needing the grades for real tests and college etc, it will be separate, right now is the time to learn all the behavior stuff. We had grades for performance averaged in with work so they could bring down our over all grade when I was in elementary school.