Did the Emperor program him that way?
Well...
This is where fluff meets the meta.
Meta:
Space Marine Chapters need to have well-defined differences, both in fluff and the table top. They need identities, specializations, roles on the battlefield. This is all to provide background and flavor to an over the top war game, after all. So you need your castle builders, your lightning raiders, your terror shock troops, your crazy hand to hand berzerkers, your sorcerers, your "Perfect" soldiers, your "Model" soldiers, your obligatory Nordic troops (cause remember, Kislev is a thing in Warhammer Fantasy), your religious fanatic troops, your moody dark secretive emo troops, your vampire troops, your bike fast attack troops, your drop troops, your bionic troops, your troops that have something to do with dragons...
Fluff:
The Emperor arranged the Astartes as one giant battle group of varied specializations. So since all Space Marine chapters need to typify their special role, and their genes come from their primarchs...their primarchs needed to embody these traits, literally.
So, was the Emperor so awesome at gene coding that he imbued the Primarchs with these traits, and programmed their personalities to match what he needed, or did the needs of the fluff to create strong, clear differences between 20 characters and chapters necessitate it? For that matter, did the Primarchs crash land on planets which
directly inform both their identities and the legions that followed them by accident, fate or because the plot and characterization demanded it?
The answer is yes, to all of them, I think. Have I read any text which explicitly states "The Emperor gene-coded [Primarch] to do [X]"? Yes. Have I read it in direct relation to their personality types? No. But the inferences are all over the place. If you buy into the theory that the Emperor "Has A Plan", it makes pretty much any explanation feasible, and gives a fluffy explanation for the careful organization of both the primarchs and the legions. Which if true, again, would make the Emperor a
total dick.
This is part of the reason getting to read the Primarchs speak and act has always been somewhat of a problem for me in the HH novels. Throughout my years of 40k, the primarchs were painted with big, bold, almost preposterous characterization. Everything about them was constructed to fit the character of the Chapter they gave life to. When you take characterization like that, and then have to stick a real personality in there somewhere to hold up a 300 page novel...it's not always successful in the novels, for me. The primarchs work better as myths, in my mind. Sometimes some writers get it, other times, they fall back on regular, kinda conversational characterization. Often the most effective portrayals of the Primarchs in the novels come from other character's perspectives of them.