Something similar was narrated from the Prophet ﷺ.
حدثنا قتيبة بن سعيد وعبد الله بن مسلمة قالا حدثنا الليث عن ابن شهاب عن عروة وعمرة
عن النبي ﷺ نحوه
No references are available.
Bukhari narrated it in the Chapters on Itikaf, Chapter, "One should not enter the house except for a need," hadith no. 2029, from Qutayba through this chain.