I can only speak from personal observations as a Canadian; note that I am using female workers/maternity examples and pronouns to try to answer the specific question posed, especially since historically my observed experience has been predominantly with maternity leaves, but also note that in Canada men can increasingly take paternity leave instead/in addition, which I 101% support and further believe will further make this less of a concern/issue.
My wife is a store manager for a major international hardware store chain, and much of her senior leadership team up and down (assistant store managers working for her, as well as her district manager she reports to) are female as well, so in their neck of the woods at least there's no passive selection. Due to nature of pregnancy, maternity leave is something that lends itself to some heads-up, so as far as I have observed the company handles it through careful, productive and communicative planning. This may include contracted positions, but also internal temporary/trial opportunities - role only being available for a period of time is not necessarily a bad thing, if you know and plan for it. Additionally, while people will fall onto a curve and experience counts (so we're not all fully replaceable blocks or cogs), nevertheless you can build an organization that has documented procedures, overlap, and shared collaborative knowledge.
I absolutely have seen people who are "irreplaceable" (and have occasionally occupied such a position), but it's all too frequently just a gap, that is addressable if you're forced to address it and need to do so ahead of time.
Similarly in my line of work, both the functional and technical experts as well as middle managers or senior leadership, happen to have a majority of female team members, and while as IT/BT projectized organization we are less proceduralized than my wife's organization, again - you see it coming, and you prepare for it.
Bottom line - I really think the combination of seeing it coming and having to deal with it, makes it far less of an issue than it might seem from the other side :-/