So if he hadn’t taken off his helmet it would not have been a penalty?
A Tennessee Vol took his helmet off a few years ago at the end of the game (in frustration, in a losing cause) a few years ago...not penalized as I recall but was punished by the coach.
A good official will officiate with the rulebook, and not by the rulebook. A running back comes up short on and 4th and 2, with his team down by 5 points with 30 seconds left, and takes his helmet off in sadness, and isn't making a scene, is not going to get flagged by me. The guy that made the tackle and is jumping around, and takes his helmet off, heck yeah, he's getting flagged.
At that point, it becomes a judgment call, and subject to second guessing in the media. But if he pulls it off to get the TV glory, it's an easy flag. Solo expressions will draw a flag a lot quicker than a group display. And the director will frequently try to catch the player on the sideline after the play, so he'd still likely get some legal face time.
And remember the corollary rule - if the helmet comes off inadvertently during a play, the player has to sit out a play on the sideline, although no penalty is assessed.