The world’s biggest insurer, Allianz, said it will turn its back on coal by 2040, both in its underwriting and investment arms.