SERVER-8416 Lock around replica set state changes