I read something about the Carnegie libraries in Pittsburgh basically doing this way back when. Apparently it was popular for people to get off work, go home, clean up, eat, then head out to the library. There was stuff there for kids like story tellers, tutors, art workshops, and more. For adults, quiet places for people who just wanted to read, places for study, areas for people to discuss various subjects, classes on various skills (painting, pottery, carpentry, etc) and the ground floor main area had a general social space. They served coffee, food trucks set up outside, and some inside. It was a popular place for people who didn’t want to go to the bar.
A combination of factors. Lower funding, suburbanization, growing means for home entertainment, growing wages sending people to more expensive options, etc.