In the first place, libraries are a great repository of knowledge. But knowledge does not equal production, and whether you or I or anyone else here wants to admit it, a tremendous amount of stuff has been invented, either totally, or almost totally, as a component of university research.
I don't mind admitting some useful things have come out of universities. But this doesn't mean we need to continue propping up the university system as it exists today. You admit it has many flaws. There are plenty of ways to bring smart people together to learn and do research. They could be nonprofit; they could be separate from teaching or integrated with it. You could even call them "universities" if you like. But there's no reason they have to resemble the current monster.
True, most research in universities is either pointless or close to pointless, but that's the Zipf curve. The ideas that are big are really, really big.
Sure, but the university system isn't sold that way. We're meant to believe the research done in universities is all useful.
People come from all over the world to study here, and when they do, they sometimes stay here. Do people come to America to study at libraries?
Universities have special privileges when it comes to fostering immigration. If America had world-class research centers with the same privileges, people would still love to come here and they'd be able to do so.
The last thing I wanted to point out is that the fact that libraries are a useful repository of knowledge does not mean that it will make people productive. Universities are not good at this either, but the consistent usership of public libraries is pitifully small. The fact that they exist does not mean that people will use them.
As you point out, universities aren't very good at this. Maybe a lot of people won't use libraries, and many who do won't be very productive. But as you suggested in one of your other points, the instances that pay off really pay off. And libraries do this much more efficiently than universities, in terms of money spent. There are a lot of university students burning tens of thousands of dollars without learning very much.