Jeff Atwood just wrote about his never-ending HTML sanitization saga. The post is filled with napalm but brings an interesting point I was actually pondering to myself this morning.
Reinventing the wheel is usually considered a horrible practice, yes, but let's face it, great hackers reinvent the wheel all the time. Except they call it "reverse-engineering". Knowing what makes software tick is a crucial skill if you ever do any sort of meaningful debugging (i.e. troubleshooting that doesn't involve guesswork and praying).
Without having the sort of foundation that only comes from implementing an compiler from scratch, how could one hope to produce things like SquirrelFish? How would one even start to talk about a scalable comet infrastructure without having implemented a web server from scratch?
At the end of the day, code reuse may be a good coding practice, but it's a bad business idea for a developer as a skilled worker. Employers can find good code for free for just about everything nowadays; it's the experience and the knowledge about the caveats of the underlying technology that makes programmers valuable.