Let me sugarcoat it so it doesn't seem to harsh. It should have been a RED card. See, there's no other way to put it.
A player, substitute or substituted player is sent off if he commits any of the
following seven offences:
• serious foul play
• violent conduct
• spitting at an opponent or any other person
• denying the opposing team a goal or an obvious goalscoring opportunity
by deliberately handling the ball (this does not apply to a goalkeeper within
his own penalty area)
• denying an obvious goalscoring opportunity to an opponent moving
towards the player’s goal by an offence
punishable by a free kick or a
penalty kick
• using offensive, insulting or abusive language and/or gestures
• receiving a second caution in the same match
This doesn't include indirect freekicks. He could've gotten a yellow, but not a red.