Split comm hooks into python-dependent hooks and others (#47019)
Summary:
Stack from [ghstack](https://github.com/ezyang/ghstack):
* **https://github.com/pytorch/pytorch/issues/47019 Split comm hooks into python-dependent hooks and others**
This is needed because we plan to move most of c10d C++ implementation into `libtorch_*.so`, which can not have Python dependencies.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47019
Reviewed By: albanD
Differential Revision: D24614129
Pulled By: gmagogsfm
fbshipit-source-id: 3f32586b932a2fe6a7b01a3800f000e66e9786bb