The difference between "If he did" and "If he had" is the same as the difference between the forms they are ellipsised for: "If he did follow" (or "If he followed") and "If he had followed".
The difference between these is that "If he had"( = "If he had followed") is irrealis (or counterfactual): it makes explicit that he didn't follow, and that this is a hypothetical.
"If he did" (= "If he followed") is not irrealis: it leaves open whether or not he followed.
In this case, given what precedes, we know that he did not follow, so there is no practical difference. But in other circumstances there might be. "If he had" implies that the speaker knows that he didn't, but "If he did", does not have that implication.