A short lived hereditary title
One other thought. I know two of Queen Victoria's grandsons were granted dukedoms in the same situation as Prince William (as the eldest living son of the Prince of Wales as an adult) but it is still rather interesting. Here is a title granted presumably with the usual stipulation that it would pass to the male heirs of the body, but it is highly unlikely that it would ever pass to another person. For either the Duke would ascend the throne, such as the Duke of York, King George V, and the title would merge with the crown. Or else the duke would die before ascending the throne, in which case if he had no legitimate sons the title would become extinct as was the case with the Duke of Clarence and Avondale.
It is possible that the Duke could have a legitimate son, and then die before inheriting the throne. The title would still be fairly short lived, for once the Queen and the Prince of Wales both die whoever holds the ducal title would become King and the title would merge with the crown (unless it was already extinct). This is a title for which it is almost impossible for it to survive for several generations. I say almost, because there is one theoretical possibility for how the title could survive. Suppose the Duke suddenly decided to become Catholic and have his children raised as such. That would remove his line from succession to the throne, but there is no reason he couldn't keep his current titles which could then be passed down for generations. I emphasize that this is purely theoretical, there is no way I could see a direct heir to the throne doing that.
One other thought. I know two of Queen Victoria's grandsons were granted dukedoms in the same situation as Prince William (as the eldest living son of the Prince of Wales as an adult) but it is still rather interesting. Here is a title granted presumably with the usual stipulation that it would pass to the male heirs of the body, but it is highly unlikely that it would ever pass to another person. For either the Duke would ascend the throne, such as the Duke of York, King George V, and the title would merge with the crown. Or else the duke would die before ascending the throne, in which case if he had no legitimate sons the title would become extinct as was the case with the Duke of Clarence and Avondale.
It is possible that the Duke could have a legitimate son, and then die before inheriting the throne. The title would still be fairly short lived, for once the Queen and the Prince of Wales both die whoever holds the ducal title would become King and the title would merge with the crown (unless it was already extinct). This is a title for which it is almost impossible for it to survive for several generations. I say almost, because there is one theoretical possibility for how the title could survive. Suppose the Duke suddenly decided to become Catholic and have his children raised as such. That would remove his line from succession to the throne, but there is no reason he couldn't keep his current titles which could then be passed down for generations. I emphasize that this is purely theoretical, there is no way I could see a direct heir to the throne doing that.