Basically, people's priorities change and the optimal living situation changes accordingly. On average, that is, I'm sure some people prefer city life into later adulthood, and some young people like suburbs.
This point seems to be mostly American and a result of how schools get financed in the US and not inherent to cities. Schools being financed by very small areas they are located in is exacerbating the divide between poor and wealthy neighborhoods for no real reason. In contrast, when I grew up in Germany, kids had to commute from the suburbs and villages to the city to attend a really good school.
Also, the amenities available in a city are quite limited as you age out of your 20s. Food and necessities become a much smaller share of what you are purchasing. Eventually you want access to tools and hobby supplies and home goods - stuff that is logistically not hauled into big cities but dropped off in the suburbs.
If the car companies manage to get level 5 self driving working well, I’ll move even further out of the city.