The cultural evolution and ecology of institutions