I do wonder if the job-for-life culture in Japan helps with this. Perhaps, rather than people being lazy because they can get away with it, not being terrified of losing your job means they can actually appreciate it, and learn to take pride in their work.
Probably that, plus a decent safety net of social services, plus teaching children to take responsibility, clean up, etc. Lots of factors involved, but the good news is that it can be done.