Backport !3847 - Refactor to allow tezos-client to use binary mode
Context
Changes in !3847 (merged) touch src/proto_alpha and we need them in snapshotted Protocol I. Cherry-picked all commits from it using the following commands.
$ git checkout -b proto-i-backport-3847
$ git cherry-pick cc227580701277ba8e806613747ee8179ca7942d^..c016c488e712184f9399c084f7db6da02337c676
Manually testing the MR
Check CI.
Edited by Fedor Sheremetyev