It depends on so many factors. What if the dog is a rescue dog and people choose it thinking they will always have it - even if they are planning children. You might have an idea what the dog is like, but most people don't understand what having children is like until they have them!
It can be a real shock how much it doesn't work out. And if you've given that dog two or three years of happiness even if you then have to rehome it again, it's better than it having stayed in the rescue centre all that time, surely? Or being put to sleep.
I rehomed a cat I had adopted from a sanctuary. It was a poor old thing, had no tail, and it developed a flea allergy which suddenly required two separate treatments every month, neither of which I could afford at the time...and I was about to have a baby. I sadly asked the sanctuary to take it back.
It was suffering badly with its skin and I didn't have the money to pay for the treatments - yes, I had insurance but they never cover flea treatments, I found out.
I like to think he was happy for the year or so he was with me, at least. There was no way to predict his medical needs when I took him home, he'd just arrived at the sanctuary in a right state, but I loved him. I still regret not being able to keep him, not finding a way to. I miss him.
I had already fostered loads of cats from the rescue centre I used to volunteer at.
We got one from a family who no longer wanted her when ds was 1. She is still with us, aged 12 now, beautiful and sweet and well cared for. circumstances can change, you have to do what you can.