Let’s go over this again.
Divorce is legal in Jewish law. Deut 24:1: “If a man marries a woman who becomes displeasing to him because he finds something indecent about her, and he writes her a certificate of divorce…”
We know the law is “perfect” from Psalm 19:7, unless you know differently?
We see divorce often in the narratives, typically in the case of wives being outside the Jewish covenant, as in Ezra 10:3 (cf. Numbers 25: 3–4). When Joseph is about to divorce Mary in Matt 1:19, an angel tells him not to, but a prohibition on divorce is not the basis. Joseph is within his rights.
We see divorce often occurring in the NT narratives. Jesus prompts his disciples to be “eunuchs” even when at least one, Peter, is married. (cf. Matthew 19:27: “We have left everything to follow you!”).
So we come to the separate matter of marital references in books of prophets, as Malachi 2:16. Please note that prophets are not sex police, and could not possibly be commenting on all human intimacies even by non-Jewish people—Gentiles never being extended the opportunity to follow Jewish law.
Please note that, in Malachi 2:16, the marriage God is discussing is God’s own marriage to Israel.
In Jewish spirituality, the relationships between deities and humans are understood in terms of marriage. Prophets — including Jesus — regularly speak to this larger situation.
So the question might be: Do marital references by prophets speak to human relationships? Then do references by prophets speak to all human relationships, or just those among the covenant community?
Christian tradition answers this by saying that God’s ‘hatred’ of divorce as expressed by the prophet Malachi is indeed pressed upon all humans.
In the actual Bible, however, divine marriages as prophets track, and human marriages are not the same thing at all. They follow different tracks.
As one indication of this, among many, we have Jesus in Matt 22:30 saying there is no marriage in the Resurrection. But… the Church is the Bride of Christ (Ephesians 5:22–33) and Revelation ends with a marriage. Jesus is not invalidating his own marriage.
In the actual Bible, Jewish law is never placed upon Gentile people, and altogether ends in the course of Jesus’ life and death (Hebrews 8:13; cf. Luke 16:16). This means that marriage is not regulated by any ‘law’ other than Jesus speaking his ‘one’ commandment in John 13:34: “Love one another.”