The practice of keeping boys in dresses lasted about 150 years after the modern concepts of childhood begin to coalese in the European mind. Childhood was much shorter than in the past. Thus a boy might spend a good bit of his rather short childhood in dresses before he began working with his father or began an aprenticeship at about 12 or 13 years of age. After the mid-18th Century Europeans began the modern tendency of prolonging childhood and ever expanding requirements for schooling. Despite the polarity of infants' clothing, children today are freer of many of the sex-based distinctions that were common in 1900, or even in 1960.
Girls play baseball, and boys play with dolls.
Sex-differentiated clothes may be more for the parents. Most adults expect to have gender information provided, to the point of feeling uncomfortable or even annoyed if the sex of a baby is not obvious. One fairly modern development is the color conventions for identifying gender. While I am just beginning to investigate this topic, geder specific color conventions appear to be a relatively recent development. In our modern liberated age, we don't like to admit it, but we seem to believe that clothing has the power to teach gender.