“There is no blame on the Prophet for doing what Allah has ordained for him. That has been the way of Allah with those [prophets] who had gone before.”
This ayah is part of Surah al-Ahzab's defense of this exact marriage (33:36-40) -- against criticism that the Prophet ﷺ married his adopted son's former wife -- affirming it was Allah's ordainment, as with prophets before him.