Honestly though, I believe I learn better in a similar manner to what you described. I would rather just read the textbook and learn on my own. I find that to be a far more efficient learning style for me. However, I typically always went to class for a handful of reasons:
1. To signal that I cared about the subject to the professor (whether I honestly cared or not). Though I had some classes that actually penalized a lack of attendance.
2. There is comradery in group struggle. It was nice way to meet other students that had a common goal. I made many friends during my time. Some of which I still keep in touch with a decade later. In fact, I met my SO in one of my classes -- all because we studied together.
3. The main reason being, I paid for the class, and I wanted to get my money's worth out of it. While passing the course and learning the material was the goal. I'd hate knowing I just paid to teach myself everything. I could have done that for free, so I wanted something more out of the deal.
One of thing I should add is that I am poorly disciplined and have poor executive functioning, so I probably picked up more in class that I would admit -- I didn't have a control to compare against. Still to this date, I rely heavily on solutions to the problems. Not in a way that allows me to cheat, but I would likely be unable to be certain I was teaching myself correctly if I didn't have the answers or know of a method to verify my work. I am confident that I cannot be confident in my answers to nearly anything. I am prone to too many mistakes.
If one goes far enough in math, one will encounter solutions where there are not clear answers and one must use all of their knowledge and abilities to support their answers. And that my YN friends, is why I am not a mathematician despite my love for the subject.