And if he chose them by grace, then it is not what they have done that made them his people. If they could be made his people by what they did, his gift of grace would not really be a gift.
They failed because they tried to make themselves right by the things they did. They did not trust in God to make them right. They fell over the stone that makes people fall.