The other answers address important aspects of this meaningful, elephant-in-the-room question. But, yes, the ideal, that you can ask questions, that something more than the mere text is conveyed, is not reliably met. Yes, very-good lecturers "add value", but this is not so common, in my field, mathematics. Sure, there's the human element, the reiteration, but if a student/learner has the modicum of self-discipline to read (several) books, there's scant reason to go and sit in a hard chair in a too-cold or too-warm room at randomly-chosen moments. I think only exceptionally gifted experts, or exceptionally gifted teachers, make going to class worth-while for a highly-motivated learner.
The "problem" is that most students cannot accurately identify their own state, their learning "tendencies", and so on. So their appraisal of "lectures", or, probably any classes at all, are not reliable, even for their own best interest.
E.g., even the "just read the book", as objectifiable as it might seem, depends on "the book" being up-front about underlying assumptions, for example. Yet there is a nearly-universal conceit in math texts that there is no context, nothing implicit, ... everything is absolute. And some of the absolutes are not acknowledged, either.
So, yes, self-learning by reading can be made difficult by the secret obstacles... but/and in-class learning can be made difficult by the very same things, merely said out loud and in a ponderous voice by unhelpful instructors.
So, yes, often, one can learn more from browsing around libraries/internets than from going to class. But it requires more effort, in fact. So, yes, many "classes" are not of value, maybe even negative net value if they interrupt more productive thinking, or, ... sleep.