After the first world war, Austria-Hungary and the Ottoman Empire were torn to shreds, but Germany stayed in one piece. Why was that?
The partition of those three countries was based on many factors, but the relevant here is the self determination of nations.
Shortly: Germany had lot smaller territories with minorities compared to the other two. Only 51 percent of the population of the Hungarian Kingdom was Hungarian and the minorities were concentrated mainly in specific areas. Turkey had large areas with greek, armenian and arabic minorities too.
The above mentioned self determination (people have the right to decide where they want to belong or get independence if they want) was declared by Woodroow Wilson the U.S. President and it became one of the guiding principles of the peace negotiations. The central european minorities saw it as the backing of their long standing independence demands while the other Entente powers saw it as the ideological base to either create new allies in central europe or direct landgrab in the middle east.
Although it was a stated goal the new countries were not pure ethnically and it caused problems later. See the sudeten germans in Czechoslovakia for example.