Evolution by natural selection brought for the first time into the
natural world the teleofunctional quality. "Teleofunctional" roughly
means "purposeful", "teleo" is the "forward-looking" aspect and
"functional" is the "operational" aspect. Initially every "meaning"
(that is, having a function) would from our perspective be endowed
with value, the survival value. But then humans started to gain
stronger and stronger consciousness, for the benefit of behavioral
flexibility. That flexibility has meant farther and farther
forward-looking, adding more and more space between "teleo" and
"functional". First, the flexibility enabled superstitions, which are
confused purposes quite removed from the initial "teleo" (survival)
aspect; but still, everything functional was teleofunctional, there
was no "problem of the meaning of life". Finally humans discovered the
scientific method which allowed to create functionality (understanding
the mechanism) without intrinsic "teleo" aspect, and (earlier, but an
enabling factor "in the same vein") the philosophical concept of
truth, which detached meaning (the third-person perspective) and value
(the first-person perspective).
Evolution did not create value, consciousness did.