It is a good question on how our gender roles are formed and when does it happen. I’ve read loads of investigations on the topic. Most of them were from the psychological perspective of course.
First of all, we need to define, when does socialization happen to a child? I believe it occurs from the very beginning, in a family. A child observes mother’s and father’s behavior. Those are first role models to follow. The child learns a lot from parents: how to walk, talk, play, eat, behave. It all happens before making friends in yard, kindergarten or pre-school.
Parents may make a direct or indirect impact on the emergence of gender differences. A direct one happens, when parents actively point out a ‘proper’ behavior for a girl/ a boy and demand it from their child. An indirect impact happens, when child naturally observes possible differences between mother’s and father’s behavior (if present) and follows one of them correspondingly to their sex or gender role they prefer.