If the kid is home then either office work was never an option, or there's another parent present. Just make sure you've got a separate room as your home office. (Admittedly not always possible with smaller apartments; this is the real additional cost of working from home.)
I see yes never crossed my mind the one working parent scenario for some reason. In that case you need a good setup. For me dogs barking is way worse than kids noise though. I prefer a baby cry to a dog bark terms of if I am working.
Where and how you live certainly matters. If your neighbours have a noisy dog, working from home won't be as good an option. And of course there's a million other reasons working from home can be problematic, especially in small apartments with too many neighbours, or living in a noisy or distracting environment. Or it might be too hot or cold to work comfortably.
Of course it's also possible for offices to be noisy or otherwise uncomfortable, and you might not have any power to do anything about it. I guess WFH is a great option mostly for people who have a great home.