The answer to this will not completely satisfy you, I fear. There is a lot of land and people between the Mediterranean Sea and the Hindukush and they have actually quite different stories. In the light of recent events however I assume you are especially referring to the region between the Levant and the Persian Gulf, the arch that contains modern Lebanon, Syria, and Iraq, possibly including south-eastern Turkey.
In this case most of the present borders can be traced back to the Sykes-Picot Agreement of 1916, a secret agreement of the Entente powers on the terms of the partition of their opponent, the Ottoman Empire, after the victory in WWI. The agreement was nothing totally out of the ordinary in its time but nevertheless secretly made. However it has since then gained quite a reputation for being at least to a large degree responsible for the "mess" the region is supposed to be.
In the Sykes-Picot Agreement the Entente powers drew borders on a map primarily according to their interests, not minding the actual people living there. While Sykes-Picot was never fully implemented due to changing circumstances (Russia sueing for peace separately, the Turkish Independence War establishing Modern Turkey), the partition of Ottoman Syria and Ottoman Mesopotamia in a French and a British sphere of influence was retained. French and British politicians created the Syrian-Iraqi border as we know it today during WWI, the southern border of Turkey was the result of Turkish resurgence after WWI.
What about what you call "ethnic boundaries"? The answer to this more difficult and I'll confer that to /u/yodatsracist who summarized the situation better here than I could hope to do. Part of the answer is that in order to understand you have to forget about the concept of "ethnic boundaries". The ethnicities of the Middle East back then were not necessarily structured along the same lines we perceive them to be today, in fact the entire concept of ethnicity is shaky at best. To quote myself on this:
Nationalism is historically speaking a rather recent phenomenon and with it came the idea that people of a certain language, of a certain faith, or whatsoever ought to be together in their own state. To us, about 200-300 years into the "age of nationalism" as we might call it, the idea that a certain group has the right to its own state comes naturally, but the people of the past didn't think in these categories.
Hope I could help you a little bit!
/edit: a crucial word was missing