My theory is after the collapse of Shield Maria Hill went to Stark and convinced him to come back to help clean up the Hydra mess. The movie states that is the last Hydra base they need to hit, implying they had been fighting Hydra since the end of the winter soldier.
My belief is that he planned to quit again after that mission until Wanda showed him his worst fear then he didn't want to walk away without leaving Ultron behind to protect the world in his absence.