God promised to keep a remnant of Israel. They will never be destroyed or rejected completely unless God is a liar. When God threatened to destroy Israel, it was only as a test of Moses or Israel. He would never destroy them. In fact, although he promised to discipline and exile them when they refused to keep his commandments, he also promised to restore them. You can't restore what doesn't exist.
#deuteronomy 8-9