Yeah, this is a classic canard, and I think it’s completely wrong, at least in software. “Build vs. buy” in software isn’t a question of the cost of building and maintaining it yourself vs. the cost of buying it from someone else. It’s the cost of buying it, learning it, working around not-quite-right behavior, keeping up with updates, and dealing with incompatibilities.
Sometimes those costs are worth it—for me, typically when it will take more than 1-7 days to build just the pieces I need—but it’s not as simple as common advice will have you believe.