can a cop legally pull you over for flipping him off?
Yes. The court decision in Cruise-Gulyas (link provided in the other answer) is flawed and once again reflects the extent of judicial hypocrisy in U.S. courts.
The court opinion cites case law to pretend that "gesturing with the middle finger is protected speech", even though any reasonable person knows that making that same gesture to a judge will result in incarceration and/or other sanctions. But the Cruise-Gulyas court eludes its inconsistency and only makes the conclusory statement that "we need not wade through those complicated questions now because these facts differ materially". The judiciary's double standard reasonably tends to discourage those who truly are in the front line to protect civilians and to preserve the law: the police officers.
Outside the judges' pretended bubble, the gesture at issue is considered obscene in the real world. Furthermore, the gesture is widely understood to resemble male genitals. Thus, it doubly fits the Michigan statutory definition of disorderly conduct or person. See MCL 750.167(1)(f) (defining a disorderly person as someone "who is engaged in indecent or obscene conduct in a public place", emphasis added). The court clearly erred in its pro-criminal allegation that "the gesture did not violate any identified law".
The officer could have argued that the driver's gesture (in the context of her patent violation and despite her knowledge that the police was lenient to her) reasonably suggests impaired judgment and lack of remorse, which warrants ascertaining whether the driver is intoxicated so as to prevent imminent or impending criminal activity. But here the court contented itself with case law regarding a "suspicion of a traffic violation".
Without reading the parties' briefs, it is impossible to tell whether the defendant officer advanced the preceding argument and/or cited MCL 750.167. However, courts are prone to suppress a party's meritorious arguments for the [judiciary's] sake of forcing unlawful outcomes.
Edited to add ...
Apropos of the comment by IllusiveBrain, Mitchell v. State, 320 Md. 756, (1990) reflects the judicial hypocrisy I discussed above. In Mitchell, the judge imposed a sentence of initially five years for the contempt of having
raised the middle finger right at me and pointed to me in a familiar
gesture that is well-known to be a vulgar and obscene gesture
Although the Maryland Court of Appeals ultimately remanded the case for re-sentencing (namely, on grounds of due process), the defendant's gesture was perceived as vulgar and obscene not only by the judge who issued the sentence, but evidently also by the Court of Special Appeals that affirmed it.
That is, the lower courts in Mitchell found the same or a similar issue in a different way. The core of the appeal was elsewhere, but it was nonetheless premised on the same gesture of raising one's middle finger.