I see you've chosen just the simple scenarios there, I was rolling all of those possible eventualities into one after the other.
Sure most people can prepare for mat leave and most normal people would. But what happens if you're on mat leave having been left by your husband, being forced out of your home into a rental that doesn't allow pets, and you've no family anywhere to support you let alone take your dog for a walk.
Most rational people's minds don't go to disaster scenarios before considering life events (otherwise we'd never have children frankly), they make decisions based on what they know/have at the time. Because that's life.
I spare my thoughts for a woman being left in the lurch by a turd of a man, leaving her with very few realistic options and doing the best by her pet.
I don't berate her for not undertaking some massive mental gymnastics falling down the "what if" route before she got the dog.
For most people the what if is "what do I do with the dog if I can no longer WFH 3 days a week" not "what if my husband leaves me and I have to return to work full time when my baby is small and I have to find a house to live in and I can't walk my dog when I get home as the baby is in bed..."
I mean she could stay home on benefits for the sake of walking her dog, but that would be a whole other thread of vicious now wouldn't it.
OP you're damned if you do, damned if you don't.
You're damned (on here) by internet strangers for even considering rehoming your pet; or
You're damning yourself (and your dog) to ongoing misery if you keep things as they are.
Do what you gotta do.