Every person is different so the same experiences can affect different people different ways. Two children can have the same genetic parents and grow up in the same toxic environment but because they have different personalities, one of them may become a rescuer and people-pleaser and the other may become a narcissist.
It's unlikely any child will be wholly unaffected by a rough childhood (though some personalities are naturally 'hardy' and are less badly affected by tough experiences) but they won't necessarily both be affected the same way (although they could be!). And on the other hand, some people are raised in wholly loving and 'normal' families but have been born with a dark personality or brain structure that is psychopathic and nothing will stop them from becoming a very difficult or dangerous person to know.
I know from experience that dealing with a narcissist is very frustrating because it seems like they should be able to be recognise that their behaviour is selfish or unempathic or rude or thoughtless etc, and yet they seem wholly convinced that they are in the right, or that other people are at least partially to blame for choices they made of their own accord, or they see other people as being unreasonable and lacking empathy for them and the hard time they've had in life. They often have a deeply-held 'victim mindset'.
I don't think there's an easy answer. I do believe that to a degree, they genuinely lack capacity for empathy and the ability to conceptualise things from other people's perspectives. My ex seemed to have very little ability to feel and articulate any feelings other than anger/irritation, envy/desire, pride and superiority/disapproval/condescension. I don't honestly think he experienced genuine and deep feelings of happiness, concern, peace, love, gratitude, disappointment, guilt/remorse, grief, admiration/awe, sadness etc within himself, and so found it impossible to recognise or care about those feelings in others.
I also think narcs are driven strongly by impulse/emotion/gut-feeling rather than consideration, logic and reason and find it extremely difficult to think things through well or consider consequences for their actions. But again, because they find it hard to admit any flaws in themselves (which I think is due to having extreme levels of repressed shame), they generally can't admit their incapacities and ask for help, like: "You know, I'm terrible at forward-planning and I know you're great at it, so I'd be really grateful if you could organise our day out and I'll pay for it in return. Please don't plan anything that's going to require any effort from me on the day as it will irritate me and I'll make the day miserable by sulking." They just don't have that kind of self-awareness.
If you have a family relationship with a narcissist who you know well enough to 'mind-read' them (like understanding and expecting the scenario above without them actually telling you) then you can probably get on okay if you limit your time with them. The key is to have very low expectations and realise that they don't really mean to be an asshole, it's just how their mind works.
That's not a get-out-of-jail-free card for them though. You're not obliged to keep anyone in your life who takes a lot more than they give. At a certain point you have to decide whether the effort of situation-management to accommodate and avoid triggering them as much as possible is worthwhile for you, and you don't need their approval to make that choice.
Narcissists do have some (limited) ability to understand negative consequences, so if you're prepared to draw extremely strong boundaries (eg "If you ever call me a bitch, whore or slut again, I will leave the relationship and you will never hear from me again"), they will probably fall into line if they want to keep you around. You do need to be very specific however. Telling them "If you ever speak to me offensively again I will leave and not come back" is too general for them to understand or stick to it.