Seems to be after WII that the pink for girls, blue for boys thing really took hold. Back in the 1800's small children and babies were dressed the same, the main difference was that boys buttoned at the front and girls at the back. Probably something to do with toilet training, as it is easier to TT in a skirt, than having to drop pants. Also could be due to the infant mortality rate, just more sensible to have one type of dress for both genders.

There are parenting articles from the early 1900's advising of pink for boys and blue for girls.

Of course this is a western culture thing, other cultures will have their own ways of dressing children in the past.