She is, at least, supposedly, created by an energy being that's basically a giant AI as a human interface. The Data Overmind can transform matter pretty much at a whim, and Ryoko's disappearance into data dust seems to indicate that they're basically data-beings. Maybe Yuki just had the boss 3d print her a child, and he felt like trolling her, so he made her a boy.
...but had a boy...You can change the diaper.Um, what should I do?You could give birth in two hours time by having data injected into you.I wanted to have a girl...That's the setting.No, th-... wait, do... do you mean what you just said... Ah! Wait! Why are you biting me?! Wait, waaait!...is a boy?!Nagato! Th-... this child...We're gonna do that, huh...?A Complicated Mother's HeartGive birth right now so that I can have another mother as a friend.Whaaa-?!...and will raise him as a girl.