But then Germany's Kaiser Wilhelm I got old and died, and was soon succeeded by his grandson, Wilhelm II - who didn't like Bismark's cautious foreign policy. Wilhelm II wanted vigorous & rapid expansion, to enlarge Germany's (and his) place in the sun. Bismark, who was getting a bit old & unsteady himself, was replaced in 1890 with a new German Chancellor, more to the young Kaiser's liking.
Note that both WWI and WWII stuck Germany in large, long, two-front European wars. And that Germany got into WWI under the same Kaiser (Wilhelm II) who had dumped Bismark for being too cautious and anti-war.