I believe explicitly identifying as male would be just as wrong to the dwarven culture.
That is implied to be the case. Discworld dwarf's are pretty weird about the whole thing, even courting dwarfs aren't supposed to find out the other's sex until after they're married, or close to the point where they would usually get married at least.
In one of the books Cheery, post coming out as female, was excited to get asked on a date by someone she thought was
probably male.
EDIT:
On the kid being murdered for not being the gender his parents/caretakers wanted, that's sadly not all that WTFy to me. Look at all the families in China who killed or abandoned their daughters because they wanted a son to carry on their name and didn't want to deal with the penalties for violating the One Child policy, or all the children physically or psychologically abused for not wanting to follow the career path their parent's want, or be part of their family's religion, or stuff like the Fritzl case, or feral children like Sujit Kumar. Parent's can be really,
really horrible to children that aren't what they want them to be.
People can be fucked up in the head. Sometimes it's mental illness, sometimes it's cultural, sometimes institutional, sometimes it's one of any number of other issues. It's just an unpleasant part of being human that a reasonable portion of us are basically monsters.