I think in these cases shelters can offer other tools in the surrender prevention toolbox, e.g., pet food pantry, free or reduced medical care. But I'd consider every pet a therapy pet in their own way, and many of these programs offer very short term care--a few weeks or a month--in situations where the person would have otherwise had to surrender their pet entirely, which is a mental health boon in itself (peace of mind that the pet is cared for and the knowledge that they'll be reunited with their pet).
For long term situations like the one you describe, I'll direct you to our article on animal orgs working with social services to keep people and pets together: https://www.animalsheltering.org/magazine/articles/all-family
#FosterPrograms