To me, it looks like any society with some form of inequality will inevitably need a way for the lower classes to escape their daily struggles. In some countries it's hardcore religion; in some it's drugs; in some it's alcohol; in some it's mindless gambling... Affinity for one or the other depends on a number of factors, but eventually we have to accept at least one of them if we want to keep society stable in the long run.
But let's be honest, the yakuza want to keep foreign criminal syndicates out of Japan because they want a monopoly on organized crime in Japan, not because they want to keep the Japanese people safe from foreign criminals. The yakuza deal in extortion, blackmail, drugs, guns, prostitution, human trafficking, all of the same criminal activity any other syndicate does. They may not be as openly violent as other mafias, but they're not nice people.
Claiming they have a "common cause" with the police is to assume that the police have no issue with crime in Japan so long as it's Japanese committing those crimes, which I think cannot be true, and would be a sign of dereliction of duty if it were. From what I understand the yakuza are losing power in Japan because the police have been effectively cracking down on them... they're not comrades in arms.
They very clearly play a role in keeping petty criminals from China, Korea, and South Asia off the streets of Japan, and it's no secret that the keisatsukan will turn a blind eye when the public interest is served. It's hard to overstate the tranquility of Japan in terms of crime. Yes, there is a rather open underworld of prostitution and that presumably includes human trafficking. But I've met gaijin girls in my language classes here who work as hostesses, and they clearly felt like they escaped from places like Indonesia and Philippines, and even in the seedy underworld here they had more opportunities than where they came from. (Anecdotal to be sure, but also first-hand.)
Also, I know restauranteurs who happily pay protection money and feel like it's a valuable service for them. Go figure.
The truly dirty business of Yakuza is moving heroin abroad--especially into the US--and that just isn't tolerated on the home front.
Then people can get the help they need and be treated as a disease if they are addicted. Stealing etc and all the other crime that comes from addicts are still crimes.
You're kidding yourself if you think Japan doesn't have drugs and crime related to it. I've met many a Japanese who loves a good smoke. It's really hard for them to get good smoke in Japan with all that anti drug control. Does it mean it's stops them wanting it? No?
From what I understand you can just buy flutoprazepam and some other fairly hardcore sedatives, so people abuse those.