"...library code is likely to be better than code that you’d write".
First, it's not always true. FOSS is the best sample how "hobbyist" flush IT with bad designed code.
Also don't forget: library is universal tool - it has code to handle as "wide" as possible things. You need only few, but very specific. Say, GUI - people made ComboBox for many uses, but you need 3-item color selection and ComboBox suxx - it takes too much efforts compared to custom made.
One more thing: library NEVER works with your custom objects - it simply doesn't know 'em! It means library forces you to use different, universal interface instead of your. ORM is the sample when "universal" way significantly worse than custom.