Why is it that numerous European states were becoming more militant before ww1
The continent had been caught in a cycle of increasingly large alliances in the aftermath of the Franco-Prussian war. This web expanded roughly thusly.
France is defeated by Prussia and their allied German states, leading to the formation of the German empire.
France seeks allies against the newly expanded Germany, while simultaneously seeking to Challenge British supremacy over the rest of the world.
Germany allies with Austria Hungary as a counter to the Franco-Russian alliance.
Italy eventually joins the alliance with Austria and Germany.
Germany begins building a fleet to challenge British naval superiority as part of an ill conceived effort to expand Germany influence and power.
Britain takes this challenge personally and does what they always do when a single nation seems poised to dominate Europe, ally with their enemies. In this case France and Russia.
Britain allies with Japan as a means of securing their far eastern colonies and allowing them to concentrate forces elsewhere.
Belgium seeks to remain neutral, with multiple powers agreeing to respect their neutrality.
Tensions rise in the Balkans, with multiple rounds of wars between the minor powers there either seeking to take territory from the crumbling Ottoman empire, or take territory recently taken from the crumbling Ottoman empire by another power from them. The wars see A-H expand their influence, Russia make noises about being the defender of all Slavs, and Britain try to shore up the Turks with Greece seeking the nebulous goal of restoring traditional Greek lands.
The major alliance blocks begin seeking to expand their influence, sending military advisors, diplomatic missions, and economic/financial support to the various minor powers in the region to sway them to their side.
Now this is not in the exact order in which things happened, and also alot is missed out because I am hardly an expert on the topic. But it should give you an idea of how the alliances spread, with several localized conflicts eventually leading to intervention by the major powers and the expansion of the alliance blocks.