Strictly on economic terms, how much of a discount would you get on a developer if he/she is likely to take 1-2 year off at some point? During that time, you have to hire another person, train them and then tell them to leave.
I have to disagree with the concern.
There's a cost to hiring humans. People get sick, have babies, attend weddings and funerals and take vacations. Men take paternity leave, women take maternity leave. These are the costs of hiring humans.
In my mind, our company exists to turn a profit, but it also exists to employ human beings. Treating them like human beings is money well spent, not money wasted.
Developers in particular are rarely terminated individually for economic reasons. There's always something for them to do, some way to extract value from them. Companies don't usually start dropping good people until they're dropping a bunch of them at once, and usually deadweight layoffs have preceded.