Awful scenes
From a training POV, should the referee have moved the player into a neutral zone and given himself space where he could back off if needed, as it looks he was quite close to the advertising boards.
I know what you mean, however, he is refereeing a football match and he should be safe from attack from anyone. Whatever the intent of the player concerned, whether it was directed at the referee or another player, there is no place for this in the game, not now or ever in the past!
The resultant disciplinary action should reflect this, however, from past experience I somehow know that this will not be the case!