I don’t think learning something and forgetting it should really be justified, it’s just not an efficient use of time.
If you wanted the benefit of knowing tools that help with linear algebra, memorize that, there’s not point cramming the entire thing just for a class.
I think a good remedy to this issue is spaced repetition software like Anki/SuperMemo. It’s a bit messy to use with math, especially with something like a proof, and they’re meant for cards that shouldn’t take you longer than say 10 seconds to solve. It is doable though if you can break things down into atomic components. And it can be worth more than you realize to have usable access to those memories for say decades rather than till the month after your class
I think it’s difficult though to make classes focus on such long-term memories because tests create such poor short-term incentive structures which aren’t easily replaceable. I think the only way to get around this is to just focus on learning what you want and if you’re missing something that seems useful to acquire it on your own rather than being required to study something and just forgetting it as soon as the test passes.