Sanji has Haki too, like Luffy and Zoro. In the Fishman Island arc, it was shown that all 3 could sense things around them at quite a distance. And considering he knew he was going to get shot at some point it's not surprising he was on guard and has his haki primed to go. And like they've shown with Enel and when Luffy was fighting Hancock's sisters, using Haki can help them predict moves which I think happened in this case.
As far as Dogtooth's ability, I dunno. It seems like; if he can see into the future, he would have seen that Sanji would have dodged so then he would have aimed for where Sanji would have dodged too... but if it was going to miss him anyway, then Sanji wouldn't have dodged and Dogtooth would have missed regardless. So basically an infinite loop of dodging?