I think we've all implemented some clever trick in our code that we started to feel proud of. It's hard not to do. Even if you just contribute to a small piece of the project, you still might have those instances of pride. We're all human, and it's fine to take a little motivation from your accomplishment. But hold on loosely. Be critical of your baby and be willing to throw it out if it isn't the best approach.
I used to really like driver/embedded programming because it seemed like there was a 'best approach' or idiomatic solution for most problems that eliminated ego. It felt more like electrical engineering. I often felt programmers working on higher level software treated their work like a personal art project and that turned me off from it.