This way, both the older people and children get to feel like they are part of a family again. Obviously, just like with your original idea, it will rely on intensive screening and won't be suitable for everyone. But there are many benefits. Except for the main goal of reducing loneliness, there could also be financial benefits for the state, in that they would be able to allocate resources to one place, instead of old age homes and orphanages they could focus on one institution that takes care of both.
That all being said, perhaps a more feasible idea would be to pair rescue animals with both elders and orphans. They would provide great companionship and it would help with the number of animals without homes.