Al-Ḥāfiẓ Ibn Kathīr affirms in al-Bidāyah that “Israel”—that is, Jacob son of Isaac son of Abraham—was the first to build al-Masjid al-Aqṣā, and that Solomon (upon him be peace) later renovated it.
If this report is sound, it closely matches the time span mentioned in the ḥadīth between the two mosques. Allah knows best.
The same ḥadīth also clarifies the meaning of the Almighty’s words, “Indeed, the first House established for mankind is that at Bakkah, blessed and a guidance for all peoples” (Āl ʿImrān 3:96); namely, it was the first House set up for worship.
Al-Ḥāfiẓ (Ibn Ḥajar) comments on the foregoing ḥadīth: “This narration explains the intent of the verse, ‘Indeed, the first House…,’ and shows that the term ‘House’ here refers to a house of worship, not simply any dwelling. This understanding is stated explicitly by ʿAlī; ʾIsḥāq ibn Rāhūyah, Ibn Abī Ḥātim, and others report it from him with a sound chain, in which he said: ‘Homes existed before it, yet it was the first House erected for the worship of Allah.’”
I add: al-Ḥākim transmitted a similar wording, declaring it “authentic according to the criteria of Muslim,” and al-Dhahabī concurred.
Al-Ḥāfiẓ Ibn Kathīr further observes in his Tafsīr: “Al-Suddi claimed that it was the very first house ever placed upon the earth, whereas the correct view is that of ʿAlī (may Allah honor him). As for the ḥadīth which al-Bayhaqī records about the building of the Kaʿbah in his Dalāʾil al-Nubuwwah, through the chain of Ibn Luhayʿah → Yazīd ibn Abī Ḥabīb → Abū al-Khayr → ʿAbd Allah ibn ʿAmr ibn al-ʿĀṣ, traced back to the Prophet…"