No way in hell. HR would slaughter me.
"Oh come on, my grandma/dog/goldfish would write better code!!!"
This would be a totally acceptable jab among guys, yet saying this to a female coworker would immediately be misinterpreted as "woman are bad at coding" promptly followed by the full wrath of the HR gender equality team.
You don't have a solid grasp on male-to-male communication in the US workplace. Please keep in mind that perhaps your culture is different.
Cheeky insults, (which "my goldfish codes better than you" OBVIOUSLY is) are not attempts to "undermine your male colleague's confidence in their ability". If you think that is not the case, then you are obviously completely out of touch with male to male interaction in the US.