Denial of hospitality is not the same as a punishment. Speak to US soldiers stationed on Okinawa and you’ll hear similar sentiments from the locals towards them
Saying “I don’t want to offer room and board to a IDF soldier who may have been in Gaza” isn’t a big leap for Japanese society, they’ve apologized for and reckoned with their imperialist past and brutal ethnic cleansing, and generally as a nation actively pushed for peace and cooperation globally. Israel hasn’t done the same, and doesn’t work towards the same goal.