I think it is related to the coming of age time.
Before that time, in the childhood, you have nothing to care about.
You don’t even have to support yourself. You don’t know how difficult and unfair life can be. This is the golden age of innocence.
It is a bad thing to lose it so you can welcome a compensation. If you are lucky you may lose your prejudices at that time.
There is a text of Voltaire which explains very well why prejudices are good when you are a kid and bad when you are an adult.
Prejudices are taught as a protection from the outside world which can be dangerous for children. When you are kid, due to that beloved innocence, you are not able to recognize danger (Mogwli and Kaa in the jungle book) so you need to believe preconceived idea that are told by your parent. For example : « Don’t talk to stranger, they can be dangerous ». But when you lose your innocence you will also be able to think by yourself and reevaluate the prejudices. Because, well, sometimes strangers are nice and you can talk to them.
So it can be sum up by : when you become and adult, you face a lot of problems but at least you can also think by yourself and make your own mind about the world.