That's right, it was an ego thing. And I think that a lot of people get into programming, or other sciences, because they are geeks and want to be able to do something "special". Vain, I know, but everyone wants their own skill that they are good at and to be able to impress people.
There is a downside to this, though. I suspect that many of the people who do it for ego purposes are the same to get into unethical hacking. "Because they can". The rush is addictive, and can lead to trouble. I was fortunate in that respect because I was older and wiser than many when they first start programming.
But with proper guidance, and if you've taught your kid the difference between right and wrong, stroking the ego goes a long way. And if he or she is an "outcast" it can really give them the boost they need in self esteem.