Yeah, Shibuya Halloween is pretty wild.
You can't really ban it. If not for the moral issue of older people dictating to younger people how to behave (which is becoming increasingly unpopular in Asian countries), but because it's just not practical. I mean, Japan did ban dancing but that was just flaunted. And in Japan at least, that could absolutely be argued to be unlawful (Japanese laws regarding freedom are quite strong).
All it requires is good policing. Preventative policing, not reactive policing.
As in, even though it's an unofficial event, predicting it will happen, counting how many people enter an area, and then shutting it off to any new entrants if capacity is reached. Requiring an area to have ticketing is also an option, paid or not. The latter requires businesses to agree with it, but for some areas I'm sure agreements could be made.
At Japanese festivals I have seen some very good policing. They'll have roads closed and routes pre-determined for where people should go and how many.