Even after the construction of the original St. Peter's Basilica, popes lived principally at the Lateran Palace across Rome. They even left the city altogether in 1309 when the papal court moved to Avignon, France, after King Philip IV arranged for a French cardinal to be elected pope.
Seven popes, all French, ruled from Avignon, and the papacy did not return to Rome until 1377, by which time the Lateran Palace had burned and the Vatican started to be used as a papal residence. Much repair work needed to be done, however, because the Vatican had fallen into such disrepair that wolves dug for bodies in the cemetery, and cows even wandered the basilica.