Fix MPI rank and world size pg initialization (#98545)
Fixes https://github.com/pytorch/pytorch/issues/97507
Test command
`pytest test/distributed/test_c10d_common.py -vsk def test_init_process_group_for_all_backends`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98545
Approved by: https://github.com/malfet