If you look at the resume of Pius XII prior to 1940, his appointments were mostly political. He negotiated treaties with the various European political entities on behalf of the Vatican to protect the property and the educational institutions of the Roman Catholic Church, much like what is going on at this moment with Saudi Arabia.
Then Rome must have felt it chose the right man for the job.