I know this isn’t going to make you feel any better but, at 48, I still get dirty looks from supervisors at work when I walk away to use the bathroom. The infantilization of adults in the U.S.A never ends. Doesn’t mean your teacher isn’t batty, though.
Dude, it won’t matter. That teacher wants to pull shit, let him. You’re almost out of there, and that slap on the wrist won’t mean a damn thing in college or beyond.
IMO don’t listen to anyone telling you to take it to the principal, at least not yet. Going over people’s heads without personally talking to them 1-on-1 does nothing besides starting drama that doesn’t need to happen in addition to risking their advancement or career.
Put yourself in their shoes, for instance if you were having a crappy day and had a bit of attitude dealing with customers would you rather have a customer tell you there is no need to not be pleasant or would you rather them talk to your boss without your knowledge and your boss deal with you? Not everyone is so in sync with their enviroment and doesn’t realize they are being a prick.
Going to superiors should always be a last resort for chronic poor performance.
If this happens again wait 'till the end of class and pull the teacher to the side and express how you feel while being respectful and chances are it won’t happen again and you will gain the teacher’s respect.(The key here is to not call out the teacher in front of all the other students) If it happens after this than feel free to get the principal involved. If nothing happens from that then get your parents involved with the principal.
Never raise your tone of voice or be disrespectful since it will only give the other party ammunition when you bring other powers into the situation ie. the principle or your parents.
You can NEVER EVER go wrong with being tactful and professional in the way you talk to others.