Re: So what's the solution?
Two wrongs don't make a right: software can always have bugs. Open source has the advantage of peer review and the chance to learn from each other's mistakes.
Apple already makes extensive use of open source software in the stack but it doesn't really embrace it. No, this doesn't mean that they should suddenly open source all their stuff immediately but that they can contribute more actively to making key libraries better for everyone. Doing this properly would mean Apple developers could spend time reinventing and retesting the wheel.
Currently, if you buy a Mac your POSIX stack will stay frozen until Apple release a new version of the OS (Apple's openssl on my machine seems to be 0.9.8y, MacPorts is on 1.0.1f). It would be a cinch for them to adopt any of the ports projects and integrate into the OS and lever their own sophisticated QA so that we all get better components.
All of this has nothing to do with a caffeine-infused development culture which I think is irrelevant here. Companies still focus on features over quality. Someone took a decision here not to implement code review, static code analysis, pen-testing, etc and all likelihood that wasn't some kid hunched over a keyboard a 3 in the morning.