This is probably not true for majority of people. Most go to school because it is mandatory, pushed by parents and society, and university gives you credentials and better job opportunities. Homework and tests are a way to get a number grade on 'how well you memorized something', it doesn't really measure a deep understanding of the topic.
As I said: they are goalposts.
Typically homework and tests are sufficiently easy (yes, there are exceptions) that if you fail them, you can assume that you didn't make sufficient progress in improving your understanding.
But I do agree that at least sometimes the difference between being good and exceptional at homework and tests can indeed be rote, "unnecessary" memorization.
- doing - failing - discovery>learning - remembering
With learning predicated on both failing and remembering it's unfortunate uni scores on 100% successful doing but doesn't teach failing well, and scores for remembering but not for learning well.