Extract ReadBinaryFile() and WriteBinaryFile() from torcontrol.cpp to its own readwritefile.{h,cpp} files, so that it can be reused from other modules.
This is a backport of core#20685 [1/20]
https://github.com/bitcoin/bitcoin/pull/20685/commits/4cba2fdafa483cbdb70f581174138ec253c80d48