It’s morally wrong if you deliberately aim to kill them. But if they endanger you, you have the right to self defense and for me, that means hitting the gas if you have to to get out of dodge.
Besides, it sill teach the others to not hang out in the middle of the road.
The solution is to drive 5 mph. They have ample time to avoid any kind of danger. Then the choice falls back onto them and if they stay in the road when everyone else got out of the way, they made that decision.
Who knows if these are not ambush situations. If they do it by an overpass, bricks and crap can come down on you, you can get swarmed and pulled from your cars.