In the past, I would have agreed with you, but really, the alternative is to use an open source project that might not be exactly what you need, and would require more cycles to interface with and get working to just your liking. Now, there are always opportunities to interface with the open source community, but more often than not, shouldering the burden of an open source project can also be a personal struggle that not everyone is prepared for.
And further, bugs can be mitigated, but it takes more code to do so, in terms of specs and tests and better project tooling. This does require more code, of course, but test code is always worthwhile. I really do have to disagree that people should be afraid to write a line of code. It can always be refactored and tested. Of course, it’s always better to write your spec beforehand, but it often doesn’t always happen like that in practice.