Some people can afford a house but choose to live with their parents instead although that's not the case for everyone. While prices play a role today, multi generational homes have been a growing trend before skyrocketing home prices.
They date back to the 19th century where at the time multi generational homes were the norm. Multi generational homes took a back seat after World War 2 and have been gradually rising in popularity over past few decades.
This article goes deeper into the history of multi generational homes (some of the details are disturbing): https://dreamcollaborative.com/thought/full-house-a-history-of-american-multigenerational-living/