I ‘d be interested to know more about how ‘imprinting’ might be a factor in creating a confused sense of identity in humans, in the way it is sometimes known to in the case of other animals. For example, when a duckling sees a boot after being hatched, instead of its mother, then follows the boots everywhere they go thereafter. Or, when a young, rescued wild animal is penned with another infant species in a sanctuary, and then when released tries to join a group of that different species even though it costs them their life.
Socialisation away from the norm is interesting in animals too, for example when a rescued fox befriends a chicken it has been kept with, or a dog doesn’t chase a cat it lives with. In these cases though the fox and dog would revert to chasing different chickens and cats outside.
I can certainly imagine body dysphoria being horrific, when it occurs - if I had a triple row of teeth for example. But even with normal body changes is not very easy to accept the changes of puberty at the best of times, or finding you hate the way you look for some other reason.
It might also be discomforting to accept being a certain sex if your parent of that sex behaves in a nasty way to you, or made you feel ashamed; or if they seem physically repellant ( dirty, lacking in self care, unpleasant habits). Or if the male parent seems misogynistic or vice versa both to their partner and/or to their opposite sex child. Conversely, a positive experience with a family member must make that phenotype attractive.
All in all, whatever a sense of self identity is, it must involve a complex interaction between the mind, the body and experience. Even just what a person does must create identity - dancer, singer, accountant, builder etc. The elements involved must extend so much beyond gender. It seems odd to fix on that. It is very worrying that children and teenagers might do so because of them being given the wrong impression.
I agree with a poster above that the actual sex of a person might well have more effect on behaviour than is currently believed - the expression of sex is not entirely social imo.
Though it is probably not possible to disentangle sex, experience, social conditioning, inborn personality, and the mind from each other.
But as for 3 year olds, I do think that they only consciously ‘know’ they are a girl or a boy in the simplest terms, based on the typical ways boys and girls look, and what they have been told. Their sense of self does seem to be strong enough though not to think they are like their pet, as far as I know. Though if they are brought up with a dog or cat they will play at being them, and might display a bit of ‘sibling rivalry’ with them. Conversely animals may try to act more like a child with their ‘parents’ when they live with a small child.