In most cases,
Sons will treat their mothers and wives the way a father treats his mother.
And Daughters will treat their Dads and Husbands the way their mothers treat their father.
There is an immediate imitation from children. So, be careful how you treat your husband or wife. Your kids are watching you and you are setting a legacy. Don’t be surprised, annoyed if they ill-treat you as Mom or Dad, they are your mimics.
And then a defense mechanism and frustration act begin from the mother or father to label that his wife or her husband has xyz drawbacks for her/his behavior like this. So, this way they put down their wife or husband in front of the child; reciprocation for the ill treatment they receive from their husband/wife. Finally, the child gets to know both the parent’s flaws which he/she makes advantage of.
And if you are making fun of your wife before the kid, also have the courage to accept the same from your wife as well. That develops a sense of equality in the kid between genders.