Vettel pitted early because he was getting nowhere where he was in the traffic. So they (his team and/or Vettel) decided to do an early pit, get the undercut on the other cars and then hope to hang on towards the end when his tyres were going. It mostly worked, helped by the four drivers behind him who were losing time due to their battles, but with the exception of Bottas in the faster car, and Ricciardo who was simply faster.