If the purpose of replay is to "get it right" it is hard to fathom a rule that thwarts that on a techinicality -- and then punishes the "offender."
Review the play, call the red flag a nullity. Or have the penalty be loss of a time out if you really need to penalize it. But the current result is just plain dumb.