I gather, Alexa, that you felt you had in some way deserved the lecture, but were hurt by the manner it was given in, and the comparison between you and your granddaughter.
In your place, I would wait until the next time you see your son, then you could mention that although you agreed with his point of view during your last disagreement or discussion, you did not care for the manner in which he gave it. Then see what he says.
If you are afraid that saying something about it, will make matters worse, you could leave it entirely until or unless it happens again, when I think you should tell your son that you find his manner of laying down the law rude and unkind.