I guess in the case of humans we have partly outpaced natural selection - nature hasn't had time to optimise for the reality we are creating, it's too slow. Short term impulses which have worked great (until now) still govern our behaviour.
It's not altruism to try to avert long term disaster beyond your own life span. It's in your own interest to ensure your progeny survives - even several generations in the future they still carry your genes. But I don't know if inbuilt mechanisms for this exist in evolution.
I'd like to think self-inflicted extinction isn't a likely outcome of evolution - but maybe it is once a certain species dominates.