Question: Do girls and boys really need different toys especially when they are very young? I am speculating part of reason why girls tend to play with Barbie dolls and boys tend to play with transformers is:

* Parents make decisions for them.

Would girls play with Lego at all?

Answer: 
I think if you have several kids of differing genders and sexes you will see that overall, no they don't need different toys & your sons can play with barbies just fine. 

What makes you assume a lego is a preferable toy to one that allows you to role-play, make up story lines, etc? What makes building better? ;)

Overall though, my children gravitate toward toys you would likely think of being typical of gender. They are homeschooled, have toys of all sorts to choose from and don't have network TV - sooooo, I'd say it's not an uncommon preference and likely not instilled by parents. That said, I do not think a parent should ever discourage a child from what toys they prefer.

That said, I wonder why toy makers make such gender specific toys (dolls saying only "mama") and why the stores most often make such gender specific sections. My sons loved toy kitchens and shopping carts, foods and such. In most store this was all put over with girl toys and many were only available in pink. While my boys don't mind some pink, they didn't want a ton of pink toys. My one son also loved baby dolls. He wanted one that said "dada" so badly and I never was able to find one. So many of these toys have several things they can do these days, there is no reason a doll maker cannot put a "mama" and "dada" switch onto a doll. None. 

And of course girls will play with legos, and transformers and generally they are allowed to. Your bigger cultural issue is are boys allowed to play Barbies, My Little ponies, Strawberry Shortcake, or similar "girl" things. Girls have been "allowed" to play with boy toys all my life, they just get thought of as "tom boys". Boys on the other hand are seldom allowed that same freedom to enjoy nurturing play, domestic play, cute play.
Ask any parent how many toys they've bought for their children that the kids outright ignored. There's a certain amount of cultural influence, but your kids like what they like. They have individual opinions and preferences from a very young age.

My eldest daughter has a very narrow interest in toys. She likes blinky lights and sounds, and will have one favorite toy she plays with until it wears out. People keep giving her dolls, which she has always completely ignored. We just sort of amassed a collection and kind of forgot about them.

Five years later, her little sister was born, and we had this big collection of unused dolls and other "girly" toys lying around in toy boxes, and she took to them like a duck to water. No one gave them to her, or encouraged her to play with them, she just found them on her own. Because of our older daughter we had sort of forgotten that little girls were supposed to like dolls.

So just treat your kids like individuals. They will definitely tell you what toys they like, and there's not much you can do other than introduce them to a wide variety.