In the context of Jeremiah 31, Rachel wept for the children of Israel who would die in exile. But as Matthew certainly knew, Jeremiah 31 is also full of hope. The prophet declares that God loves his people “with an everlasting love” and that he will make a “new covenant” with them (Jer. 31:3, 31–34). Since citations of the Old Testament draw upon the wider context, Matthew would have us understand that God yet loves the people of Bethlehem and will restore them, and all who likewise suffer, even as he restored Israel after the exile.
Herod died a few years after these events, so that it seemed safe for Jesus and his family to return to Israel. Accordingly