I’m not sure – maybe a layout is happening because you are changing the size of a node. Although I do not know why the order of the male and female nodes would change.
Try setting this on your all your node templates: { layoutConditions: go.Part.LayoutStandard & ~go.Part.LayoutNodeSized }