Is narcissism a defense mechanism? Are parents responsible?

Deep inside, narcissists feel shame. Is narcissism a defense mechanism to protect their ego from pain or shame? Have their parents instilled it in them?