Governments have repeatedly failed to learn lessons about keeping their residents safe and building better social housing for their future.