Several leaders were itching for war, to build empires. Emprice building was normal to them as was going to war to achieve it. They opinions we hold today on war (largely from reflecting on the world wars) are not the opinions they had about war.
They gave commands to prepare for war and just needed the excuse to say go. I think the not-war outcome was very unlikely.
Which leaders? I don't believe any of the players thought they would gain empire in Europe. Everyone was trying to be defensive, combined with slow communication and poor politics. Now that historians have access to much of the internal documentation it doesn't seem like an inevitable war. If only the Habsburgs had been more decisive, or Wilhelm more politically astute, instead of making grand gestures then going on a boating holiday with his British naval mates.
It's not that they needed an excuse to say no, it's that they each thought backing down would be worse. And tbh I don't think any the current leaders are better. Nicholas II "I will not become responsible for a monstrous slaughter" vs Putin's war of choice.