I don't think is optimal, either. It's not worth investing in onboarding someone, getting them situated in a team, then having to tell everyone a few months in that the person quit. If that seems like a very likely outcome, it makes sense to avoid it.
My experience is the most impressive people are significantly less likely to quit early. If they where doing a lot of interesting things in their free time they either become engaged with interesting projects at work or put in a solid work week and then go home to have fun with their own projects.
Albert Einstein for example worked for several years as a patent examiner while developing special relativity. Sure his contemporary physicists mostly worked in academia, but teaching is as unrelated to research as everything else yet they still did it.