All the patriarchs had foreign wives. How do you condemn Moses, Abraham, David and Solomon?
The foreign wives were concubines.
Of all mentioned, only Abraham Avinu A"H is a patriarch.
He sent away all his concubines and their children to the Far East.
Moshesh Rabbenu A"H also sent his Midyanite wife and children away.
Until the establishment of the tribes, marriage outside the house of was avoided.
Which is why after the establishment of the House of Israel,
King David A"H himself a grandson of Ruth the Moabite,
could legitimately convert daughters of other kings.
King Shlomah A"H, King David's son,
was permitted the same limits
according to law.
'Ezra HaSofer A"H,
reminded that the priesthood is
not allowed the same as the royal house.