Whether or not one comes up with a number of years since PhD, since tenure, etc., for faculty to stop taking students, that is not the determining mechanism... except in a few cases where the cause is simply fatigue or disillusionment with the whole enterprise. But the latter seems uncommon.
Rather, the absolutely dominant cause is senior faculty' estimated time to retirement. Not only would it be bad to retire while one has a PhD student still in progress, but, further, it would be bad to retire while one has a former PhD student pre-tenure. Thus, taking on a student is approximately a 12-year commitment, at least, I think.
And, then, it becomes hard to clearly picture one's own energy level and frame of mind 12 years into the future...
Edit: as to why it might be bad to retire when one has a not-yet-tenured former student: very often, unless the student has taken a sharp turn away from the general enterprise of their advisor relatively quickly, the advisor will still be a leading expert concerning the topic. Even with the presumption that the advisor will be positive rather than negative, that opinion is important. If the advisor is retired, or is operationally retired, the expert-ness of their opinion, e.g., toward the future and future developments, is weakened, and their credibility in appraising future contributions of their former student is weakened. One wants to be visibly sufficiently engaged so that one's opinions are connected to current and future events, not only archival or historical or nostalgic stuff!
... and to have this presumably-positive, presumably-helpful letter simply due to retirement or disengagement is a loss that many could not afford. Nothing overtly bad happens, but one has lost a great deal.