"does evolution think ahead?"
No. Evolution proceeds towards local minima. That's why some features of organisms can be non-optimal.

In artificial systems, there are ways of ameliorating these effects. I'm don't know whether there's a biological equivalent to something like simulated annealing. (Although it's possible that some hormones might serve that kind of purpose.)

In any case, even if it's true, it's just a way of reducing the effects of not being able to see ahead.