[RPC Framework] Separate initialize_from_module_rref method out of RemoteModule constructor (#59292)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59292
#Closes: https://github.com/pytorch/pytorch/issues/58274
Create an alternate initialization method, and also create a few util functions to avoid duplicate code.
ghstack-source-id: 130575373
Test Plan: buck test mode/dev-nosan caffe2/test/distributed/rpc:process_group_agent -- test_create_remote_module_from_module_rref
Reviewed By: vipannalla
Differential Revision: D28825895
fbshipit-source-id: 87803e94d9b50f94e1b7b2c99b9bf1634e20d065