Shintoism and Buddhism play a role as well.
With Shinto there is the belief that Kami (spiritual beings/deities/gods) are in everything. Literally everything has a spirit or essence, even mundane everyday things like a toilet are worthy of respect,
therefore, you keep the toilet clean, not only as a matter of hygiene.
Buddhistic beliefs play a role in that there is the belief that all things are interconnected and have intrinsic value. Everything is interdependent on everything else.
Japanese cultural value of harmony also plays a role. Harmony in relationships, with nature, and in society is highly valued so you end up with people being more respectful towards others (not talking on the phone on the train, keeping the toilet clean for the next person, wearing slippers in other people’s homes so as not to bring dirt inside - and obviously your own as well…but wearing your shoes inside someone’s home is a huge, huge disrespect).
As for suicide rates, people often bring this up when talking about Japan, yet America has a higher suicide rate but no one brings that up when talking about America?
And as for misogyny and racism, yes Japan has these issues, just like every other country in the world.
People have very weird ideas about Japan because all you hear about are these same talking points, and what people get from sensationalist travel shows and anime culture. The entire country is not a maid bar, nor a penis festival, nor geisha and samurai. The country is just a country full of people trying to live their lives like any other human being. There are good aspects, and there are bad aspects, again, just like every other country in the world.