From "Commonly Held Misconceptions about Historic Costume" from "The Clothesline" website:
Why did they dress little boys like little girls?
Though adult roles were extremely gender specific, small children's clothing was not...
Like many other aspects of dress, the visible implicators of masculine and feminine have changed over time. The color schemes we associate with the identification of an infant's gender did not develop until the early to mid twentieth century... Finally, the use of pants for infant and toddler boys could create additional difficulties as fasteners commonly used today (snaps, zippers and velcro) were not available until the twentieth century. In the time before a child was potty trained, dresses would provide cover and access to diapers.
Until recent decades parents were not as concerned with declaring a child's sex... Gender would not need to be advertised to others who most likely knew the parents and the gender of the child already.
Beliefs about the nature of children also supported the idea that children developed personalities and individual traits as they grew, but were not necessarily born with them. Until babies grew into toddlers (2 or 3 years old) gender would not play a role in their lives. This may have been partially due to the high rates of infant mortality. This lack of individuality may have been a form of psychological protection for parents facing the likelihood of losing infant children.
Read the entire "Myths" online article here.
[Note: This blog host has an old photo of her grandfather wearing a dress and with long hair! He grew up to be very masculine: a coal, clay and sulfur miner; and later a welder. No gender ambiguity whatsoever!]