Telling your son not to “be such a girl” lets his sister who overhears the conversation know that being a girl is not a good thing and she should be sorry and ashamed of herself.
It also reminds your son that being a boy is better than being a girl and therefore he is better than any girl he will ever meet.
Also if said son actually turns out to be a daughter it tells her that being what she is is so bad that she should hide it from everyone.