If we have a B cell for every possible type of antigen, why aren't all of them memory B cells? From my reading, I have deduced that memory B cells are effectively the better version of normal B cells, activating faster and being more effective, which is why pathogens that are exposed again are typically dealt with much quicker. But why go through the trouble of getting infected, only to have to gain "immunity" to easily defeat the threat the second time. If all B cells are memory cells, the thought of autoimmune diseases and allergies being extremely common may arise. However, our own B cells have mechanisms that prevent them to attack self and allergies. I know that this could just be a product of evolution, but I wonder if there is a clear reason of why this wouldn't work.
(please note that I have no other experience of the immune system besides reading books, watching videos, and google searches, so feel free to point out possible misconceptions I may have [also this is my first post so hopefully I am clear with my question!])