rewrite rustup to support caching nightlies, protects against truncation errors

This closes #19168.

Please be careful reviewing this since this gets used all over the place. I've tested all the options and everything appears to be working though.
Alternately, it could be stored in the dated folder, but all cached installs could be checksummed from the network before installing. Might be a slightly simpler arrangement.