Developers ... why do we insist on build vs buy?

I've recently been in this situation a couple of times - looking at either writing something myself to solve a problem, or purchase a product off the shelf to either integrate or run alongside my package.

The first time, when the project was something that I am solely involved in, I decided to go down the "do it yourself" route. This was more optimal for me as simply there was no time constraint, and no specific (immediate) financial cost to me putting in "just enough" functionality.

However just today I saw the other situation. A development team whereby they are looking to spend significant time on building functionality they could easily purchase pre-built from a third party vendor. And in this case, it would work out EXACTLY the same price as the estimated hours -- and this doesn't even include any "fudge factor", maintenance or the never ending tweaks that would be needed. And yet as developers we tend to do this so often - instead of realising that it is not always the best way, we push forward and insist that we can come up with something better.

Perhaps it is time that we stepped back and realised that it might actually not be a good idea to write this complete stack of support tools, and instead look to see what is there already? After all, we do purchase SQL Server and Windows Server ... or perhaps we should write our own replacements for these too ...