This interpretation isn't precisely correct. We know from archeo-anthropology that the "stable" was more likely the lowest level of Joseph's family residence. There would have been a manger, but it wouldn't have been in a cow-shed or separate stable structure. Luke's actual text says Mary swaddled him and laid him in a manger because there was no room in the "kataluma" – mistranslated as "inn." The word "kataluma" is a lodging space in the home, likely of a relative of Joseph's.
We know this because Luke later used the correct term for "inn" for "The Parable of the Good Samaritin" – pandocheion.
I first read about it in the writings and lessons of Dr. Mickey Efird, Professor Emeritus of Duke Divinity School until his death in February 2021. You may read more about it here: https://hebraicthought.org/jesus-born-relatives-house-not-an-inn/