In his commentary to Leviticus 26:16, the Ramban gives the same interpretation, though only hinting to the identities of the two nations:
ושם הבטיח שיכרת ויכלה המגלים אותנו שנאמר (שם פסוק ז) ונתן ה' אלהיך את כל האלות האלה על אויביך ועל שונאיך אשר רדפוך והנה אויביך ושונאיך רמז לשתי האומות אשר ירדפו תמיד אחרינו
And there he promised to finish off those who exile us, as it is written, "And the Lord your God will place all these curses on your enemies and those who hate you, who chased after you." "Your enemies" and "those who hate you" allude to the two nations that always chase after us.
Since the rest of his commentary on the verse doesn't quote any other sources for his historical interpretation of the verses (though he does quote other sources for the history itself), and this identification doesn't appear in any earlier obvious commentary, I think that this interpretation is likely to be his own idea.
Rabbeinu Bachya, who lived after the Ramban and often quotes him, also identifies the subjects of this verse as Esau and Ishmael (first edition, censored from later editions). The sources he brings from the Talmud and midrash are not explicit, so I don't think it's likely the Ramban relied on the same sources (in fact if the Ramban had used the Midrash Mishley, I would have expected him, like Rabbenu Bachya, to identify שונאיך as Edom instead of Ishmael). It's unclear to me whether Rabbenu Bachya is relying on the Ramban or another source without quoting him.