The whole political situation was unstable. They made a truce, but it was a classic prisoner's dilemma. The first one to betray the other would have a substantial advantage over the other.

On the other hand, there was trust between Hashirama and Madara. And Hashirama did sincerely want Madara to be the Hokage, but failed to make it happen. So the village will be a democracy. Great. Hashirama could have campaigned for Madara, and Madara would have won by a landslide. Maybe the story would have turned out differently if Hashirama had been a better leader.