Ack! You do not understand that kids categorize and make connections! ( I am just kidding! :) )
Really, kids just make connections about stuff on their own, from what they observe. Unless you have him only watching Monster Truck Rally and tell him to leave the room if a female is watching Rainbow Fantasy Fairy Dancy-Prancy Show, he's just going to make some assumptions. But commercials are a great conveyer of the sexist message, in that most toys are marketed to boys OR girls, rarely both.
Does he have an older sibling? If so, he might have heard this from them. Especially the kids from 4-12 or so-- they are super hung up on 'boy/girl' specifics and they impose a huge 'boy/girl' separation of toys and activities. Or if there is any show on that dealt with this as a topic. ("Sally can't play with Jude because he told her only boys play with blocks/trucks.... whatever".) Kids are little imitators and honestly, I don't usually see this sort of strongly *verbalized* gender preference at this age.
So, unless you are sending him to an antiquated daycare program (which might encourage him to spend more time doing 'boy' things than exploring the house play area or dollies-- and some old-school adults may direct children in this way) or he's seeing/hearing it, I wouldn't worry about it.
What you CAN do: give feedback which helps to reinforce that all things are 'for' everyone.
"I like all colors, but you know, X is my favorite."
"I think trucks are neat too. Let's run some trucks down the ramp together."
Gender neutral statements which affirm that activities can be enjoyed and fun for both boys and girls.
For what it's worth, I do let some of this stuff go. My son got into a serious truck phase when he was little and wanted to be an excavator operator for a while. Totally stereotypical? Yep. But it was more important to me to validate his desire with "Wow, that would be fun to use such a big machine" than offering other gender neutral distractions. I volunteer in my son's library and see that boys get bombarded with hyper-masculinity (via superheroes, Star Wars, etc.) and girls get spoon-fed hyper-feminine models (Barbie, Disney Princessess).... all of these are Early Reader offerings, so the kids really don't stand a chance of not getting these messages in some way. The corporate media and toy companies are counting on full media saturation/cultural saturation of products that are total stereotypes. What I try to teach my son is that mom and dad *both* have talents and abilities to bring to the table; that I'll play Legos and Dad can wash dishes and make dinner, etc. Modeling is the BEST way to go forward.
As for your son handing you the girl figure-- kids at this age are bossy and assertive, trying out what it's like to 'lead' the playtime. I would have taken the girl toy and said "Okay, I have the girl, what should our people do now?" And then listen and play along. Maybe your girl and his boy action figure are now going to go conquer the world, only you have to build it with blocks first. (extending his play) And then, your 'girl' could be a great builder! She could say "I'm so strong, I can lift up this big piece of wood! I'm a builder!" You can incorporate the messages you want into your play, too. :) My son's favorite story to play with one of his boy buddies at kindergarten is "Super Kitties".
In short, kids are too little to have 'neutral' views. They thrive on absolutes and concrete connections (the pan goes in the kitchen; pajamas go in a drawer; girls like pink and dolls; boys like guns and heroes and blue...etc.) Give it another 15 years, maybe.:) I have worked with kids for a long, long time and what you see-- please don't let it worry you. Just know that your actions are the best example!