Some days it can feel as if climate catastrophe is inevitable. But history is full of cases – such as the banning of whaling and CFCs – that show humanity can come together to avert disaster