Jiraiya puts the Shodai, Nidaime and Sandaime Hokage's deaths in the same category ("I wanted to die like them"). As we know, the Nidaime, Sandaime, and Yondaime Hokage all died, sacrificing themselves for the village. It's only logical that Hashirama, the Shodai Hokage, did the same:

So I believe that Hashirama sacrificed himself for the sake of the village/his comrades.