Totally agree it's a balancing act. Sometimes the existing tool is exactly what you need, in which it would be a waste to re-invent it. Ideally though, things should be evaluated case by case, rather than sticking to a dogma.
I just happen to work at a company that's experienced the flip side of your experience. We ended up wasting millions on software some managers thought fit our needs. However, turns out it really didn't fit our needs after all was said and done, and they said if they had known everything up front (rather than what the salesman had said) they wouldn't have bought the software in the first place.
It is a balancing act, a lot of times building on what exists is the best case but when it comes to your core competency and what distinguishes your business, that is where one should focus their development efforts. If you are rewriting Postgres you will just end up with a shittier database.