Asking for a reference years in advance?
There is really no reason not to do this. I would suggest that you either get a reference sealed in a signed envelope, or, possibly even better, have the professor(s), leave a reference letter with the department office (secretaries) with instructions to send it out on request. The recipient will want some assurance against forgery, of course. 

It is usually important that the date that the letter was written be included on it, so that it can be balanced against other, more recent things. 

Unless you have several sealed copies, you will also need a protocol for resealing it and returning it to you. 

When you ask the professors, explain the need as you have done here. I doubt many would refuse. 

Another option is to maintain contact over the years. Some professors welcome this (others may not). Many like to hear from previous students with a quick update on successes and plans.