That's an oversimplification. Pre-existing notions about warrior conduct certainly played a role, but "samurai" were a class (bordering on caste); attitudes descending from bushido were a top-down mandate, enforced by the officer class, not something widespread in common civilian life (save for knowledge of how one is supposed to act towards high-ranking personnel).
If you think that the domestic propaganda machine wasn't running at mach speed in order to shape public perceptions to what would be most beneficial to the Imperial Army and Navy, I don't know what to say. They definitely were, and they definitely pushed, from multiple angles, the idea that surrendering would result in a worse spiritual, material, physical, and psychological outcome than the alternatives (take your pick of whichever motivates you most effectively).