How being irrational helps us cooperate and survive