The risk of Iraq's largest dam collapsing and unleashing a huge wave onto Mosul is affecting plans to retake the city from jihadists, an adviser to the prime minister's office said.