Even before the Islamist militants retook control of Afghanistan in August, fighting had forced more than 550,000 people to flee their homes.