At the end of WW1 both Austria-Hungary and the Ottoman empire were broken up, but Germany was left intact, apart from some bits of territory given to Denmark, France and Poland. Why did this happen? if Bismark's nation building had been undo, things might have been very different.
It's much too complicated to reduce entire libraries to a Stackexchange answer.
It's all about interests. But it was an interplay of (balance of power) play, economic considerations, desire for peace, peace in the future, and the desire for revenge and punishment. Every delegation pulling their own strings, but often in opposite directions.
World War One was the war to end all wars. That means, peace should then be the default condition for Europe, better yet, the world. But OK.
For example Italy wanted a grab of land, France wanted a grab. All those nationalists in newly to be formed countries wanted their own territory and power. England mainly wanted peace, as in peace the economy flourishes across the board, and not just for war equipment. The US were largely in the same boat as England. But the powers that did negotiate peace terms, meaning: excluding those who lost the confrontation, all had different ideas on how to accomplish their interests.
While France's Clemenceau wanted to squeeze every last drop out of Germany to pay for the war, to punish Germany, and to strengthen France and prevent another war by stripping Germany of any capability to wage one, England calculated more coldly that only a Germany that was halfway about her wits would be able to pay for all the damage done and participate in world trade in the future. Meaning: to sell to England and to buy from England.
Then by 1917 we had the Soviet Union on the map but firmly pushed to the kids table, despite everyone being scared that the ideas taking hold in Russia might make the rounds, perhaps by force. In such a case a military bullwark called Germany that stops armed spread of communism would come in handy for al the reactionary powers further West.
When it comes to comparing the fate of German Empire to Ottoman Empire and Austria-Hungary, then there comes the perverse spectre of nationalism. While Austria-Hungary and Ottoman Empire were seen as multi-national states, Germany was the exact opposite of it. In fact the German Reich was founded by excluding Austria from it as it was not nationally homogenous enough. As nationalism was seen by many as the guiding principle of the day, it stood almost to reason to reorganise the political map of Europe according to those principles.
Only that that failed, predictably, since the conditions on the ground were quite different than nationalists from all sides fever dreamed into their own reality or futures. Europe consisted of so many minorities, that also settled so intermingling, that drawing clean borders derived from these principles would result in an atomised map with more principalities than there were in the Holy Roman Empire.
At the start of the war, prior to US entry, President Woodrow Wilson released his Fourteen Points, a set of principles on whose basis the postwar peace should be negotiated.
This was essentially a view that wholeheartedly endorsed Nationalism: the idea that different peoples should have different governments. Where there's a dispute, it should be put up to a vote.
There were some outs here. It also flat-out stated that Alsace Lorraine needed to go back to France, and (overwhelmingly German) Austria needed to remain independent of Germany. But still this philosophically represented a post-war situation that would imply very little loss of German territory, while being an utter death-knell for multicultural "empires" like the Ottomans' and Austria-Hungary.
In practice perhaps you are correct this was a bit of a tactical mistake, as Germanys' two multi-national Imperial allies were arguably more liabilities in the war than aids to Germany, while the most dangerous opponent was just left stung rather than dismantled. Machiavelli certainly wouldn't have approved. However, the idea behind the 14 points was to leave behind a Europe where political boundaries matched cultural ones, and thus there shouldn't be as many ethnic festering wounds lying around generating conflict (without having to resort to periodic Machiavellian violence).