Here is the way I look at it from perspective of managing software engineers.
If one of my team members came to me, said she was pregnant and going to take maternity leave. I would make sure we adjusted the software plans so would take leave and come back to the team. If someone was called for military service or had to take care of an ill family member for two months or two, same thing. In each of those cases, I would have legal requirements to do so, but would also be right thing to do.
If a team member came and asked to do an extended bicycle ride or similar longer time away - I wouldn't have the same legal obligation and I'd look at it slightly differently: how good an employee were they, what was their track record and passion. If they were good at what they did and we both saw this as a leave where they'd come back, then I'd work with them to allow a personal leave of absence for the extended trip and adjust the software project in similar fashion. If they weren't so good or perhaps not seeing this as their passion then we might have a conversation if it would be better fit for them to quit and find something better on their return. I'd still wish them the best but not have that leave.
So looking as an employee there is some luck involved in getting the right situation, company and boss. However, there are also things I can do to make it more likely I can take this leave and with right bosses, I've been able to do this multiple times for extended trips.