Rome is reluctant to give dispensations for the Under 40's in case they change their minds...
The conclave at which JPII was elected petitioned the future Pope to tighten up on the procedure for dispensations from priestly and religious commitments. So whoever it had been would have been bound by an express wish of the College of Cardinals.
JPII started out with an extremely tight policy on this, but it has been revised several times already. For quite some time now, it has been more liberal than ever since 1978.
Why 40? Apparently, several cases had seen younger petitioners later change their minds. It is not an arbitrary age, exactly, but someone had to draw a line of demarcation somewhere. It is agreed by those who count in such matters that 40 consitutes a kind of psychological watershed which will not guarantee but favour more mature decisions.
That is all there is to it, I think, except to say that all this can change at any time. As I have said before, it is a question of convincing Bishps' Conferences, individual Cardinals or the Congregation for Divine Worship and the Discipline of the Sacraments that it is an issue worth discussing.