I have thought a lot about this. I think my solution would be to volunteer in a way that I could get my pet fix.
And if I have the financial means, I would adopt older pets (that might require more medical care due to their age) that would have less of a chance of outliving me.