config.mk: Added variants of `valopt`/`opt` that do not automatically `putvar`

Fixes `config.mk` so that it should not contain multiple inconsistent entries for the same option.

Used aforementioned variants to extract options that have explicit `putvar` calls associated with them in the subsequent code.  When the explicit `putvar` call was conditional on some potentially complex condition, moved the `putvar` call out to the main control flow of the script so that it always runs if necessary.

----

As a driveby fix, captured the error exit when doing the test run of `rustc --version` from `CFG_LOCAL_RUST_ROOT`, and signal explicit configure failure when it did not run successfully.  (If we cannot run `rustc`, we really shouldn't try to keep going.)

----

Fix #17887.
Actually, it looks like a number of these can just be `valopt` with removing the `putvar` below. I don't think there's any particular reason to have the `putvar` at the end of the build script, so it's fine to have up front!