It's widely acknowledged in behavioral economics that biases have their uses. In fact, usually the phrase used to describe them is "Heuristics and Biases"[1].
It's first and foremost a heuristic -- a reasonably good way to generate good behavior. Secondarily, in certain specific situations, it causes non-optimal behavior.
[1] ( https://www.amazon.com/Heuristics-Biases-Psychology-Intuitiv... )