Hardening and generalization for non-Tor usage
This MR is submitted purely for the record. As was discussed in the MRs mentioned below, this is not planned to be merged by the maintainers.
This MR includes the following MRs, with some updates:
It closes #40378.
And partially addresses the following issues: