http://www.paulgraham.com/identity.html
I can suggest three approaches to not feeling guilt over using other people's code:
1) Get "writing difficult programs" out of your system by writing some really difficult programs. Don't let it contaminate your more practical work. Optimize separately.[1]
2) Notice inconsistencies related to the guilt - can you do more good in the world with the time and money saved by reusing existing code? Know the concrete thing you're trying to achieve, and remind yourself of it when you feel guilt over trivial things. Another inconsistency: you probably don't feel guilt over using Intel processors or Linux or all the amenities of civilization.
3) The nuclear option - hundreds of hours of meditation. If you can notice the guilt over and over again, or repeatedly ask yourself who is feeling the guilt, you are almost certain to attain mastery over these unwanted thought patterns. See [2]
[1] http://lesswrong.com/lw/6z/purchase_fuzzies_and_utilons_sepa...
[2] http://sharanam.tumblr.com/post/865951869/kenneth-folk-a-sys...
Note that "value" may be different for different situations.
* If you're writing code for a bootstrapped one-person startup, i.e. this is a software product, website, or service that you're going to sell, then you would probably measure value as expected profit.
* If you're writing code as part of your job, you should probably be trying to maximize the things that the software's supervisor(s) / user(s) want the software to do. This is usually (but not always) aligned with expected future profit/revenue for the business.
* If the project is a learning experience to improve your own understanding and capabilities, then you should seek out unfamiliar technologies and interesting problems, and not worry so much about polishing the rough edges.
Sometimes I also feel that way. But then I remember that I'm not writing a data-structures library or ORM framework, I'm trying to build a product.
There's absolutely no shame in using battle-tested code that somebody else wrote. If you really do experience guilt though (you shouldn't), the easiest way I can think to mitigate that is to just promise yourself to contribute any improvements you make, and don't worry about whether or not those improvements are accepted.
As for not feeling guilty, maybe you should give something back to the community? Work on an open-source project or something, maybe?
Or maybe you can put it on the same level as something you're happy with. Like working with other programmers in your company, whose code you could probably write.