The most iimportant thing to do over the next 40 years is build up a friendship group.
My DS and DDiL are part of a group of friends that include them, married with children, but also another 8 or 9 close friends, some on their own, some still with parents alive. some with partners, but all living in the same town, sharing interests and all supporting each other. The oldest is now in their 60s, the youngest 52. Several spent, who would otherwise have been alone spent Christmas day with DS and family.
As well as retirement developments there are also co-partnership dvelopments where, almost always single older people live communally but seprately. There are not many, and those existing so far, seem to be women only.
But, as others have said, you ar worrying about this far too soon. over the next 3 or 4 decades more and more people like you are going to be lookingfor solutions to the same problem and will undoubtedly something will have been dveloped.
Retirement villages and care homes started up as women came back to work and could no longer care for parents full time they way they had been expected in the past, and to care for the rise in dmentia cases arising from increasing longevity.
When a problem becomes common enough, solutions arise.