Refactor the tor-dirmgr bootstrapping code more gracefully

eta requested to merge eta/arti:dirmgr-purification-2 into main

This is a more conservative, incremental attempt at parts of !458 (closed). The main thing this patchset does is get rid of WriteNetDir entirely, making the bootstrap state machine a lot more pure; some of the helper functions in are also tidied up a bit and made less reliant on the DirMgr.

There's still a lot I'd like to do (mostly tackling the structure of the main bootstrapping code, and the other list items in !458 (closed)), but I thought I'd send this patchset in, seeing as it meaningfully improves the state of things as is!

This is spread across lots of individual commits (an eta first!), which all have hopefully useful commit messages and should all make sense on their own. (Doing things this way was a bit demotivating / slow-going at first, but I seem to have gotten the hang of it more nearer the end.)

Merge request reports