Typically those flags will not be thrown if the defender is going for the ball (as he should). This defender was facing the receiver.
Whether it was the right flag to throw as it happened is almost immaterial. What is material is that it was called, announced by the head referee and then waived. Why would the head ref on the field waive a call that he had already announced. A DPI call that is not reviewable on replay. What happened that caused him to do that?
“This defender was facing the receiver.”
He didn’t have any choice the receiver was holding his facemask. You can see it at the start of the video here:
http://ftw.usatoday.com/2015/01/refs-pick-up-flag-dallas-cowboys-detroit-lions
The receiver did let go when the ball was thrown...