Van der Poel's reaction can't be condoned, but his anger in the heath of the moment can be understood. If someone did this in the Tour, they would probably send him home.
When there are spectators who misbehave, by booing, yelling offenses or throwing fluids, they should be removed. The organizers, security guards or the police should intervene by sending them away or letting them keep distance, to avoid things getting out of hand.
The majority of spectators is very respectful and supportive towards the riders, but a small minority of troublemakers can be enough to ruin the atmosphere.