I would venture to say that, first, you probably need to look at Iraq and Afghanistan independently. Due to personal experience, I know a lot about Iraq. A bit less about Afghanistan.
Iraq is an artificial country. Like so many post-colonial states, Iraq was composed of borders drawn for the convenience of the colonial powers and not because of any shared qualities of the folks who live within them. Also, during the Mandatory period, the British used the tactic of installing a minority group (Sunni Arabs) as a ruling class over the majority (Shia Arabs). This followed from Ottoman practice, who also favored Sunni over Shia, as the Sunni followed their chosen branch of Islam and also respected the Ottoman sultans as caliphs (God’s leader on earth — kind of pope/emperors).
As importantly, Iraq is the heartland of Shia Islam. The main Shia shrine (Karbala) is in southern Iraq, where the last Shia caliph Hussein was killed in the year 680 CE. Most of the inhabited area of Iraq (the Tigris and Euphrates valleys) was also part of the Persian (Shia) Safavid empire from ~1300 to 1736.
Of course, you also have a substantial Kurdish population in the north and east of the country. The economic power of Iraq’s oilfields also exercises an influence.
If you view Iraq as a chain of city-states (which is probably the best way to get to a Swiss-esque result), you see that the population runs mostly along the Tigris, starting at Mosul (mixed Sunni and Kurdish) in the north, past Kirkuk (mixed Sunni/Kurdish), Bayji (lots of oil), Tikrit (the only big city that is really Sunni), Samarra (host to a major pilgrimage site), Baqubah (Iraq in miniature — Sunni, Shia, and Kurds), Baghdad, Karbala (major Shia pilgrimage site), Hillah (Shia religious center, Sadrist stronghold), Najaf (the Vatican and Oxford of Shia Islam), Nasiriyah (Shia), Basrah (Shia, the other big oil field), the Shatt-al-Arab marshes (Shia but genocide-d by Saddam in the 1990's), and the country’s tiny coastline and only port at Umm Qasr. West of the river valley is very sparsely populated and predominately Sunni.
But because Iraq is a country that has had to generate its own identity, the ties that bind the various people in the country aren’t very tight, and are centered around power, control, and access to the two main oil fields in Baiji and near Basrah.
Also, the Swiss tradition of small freeholder-led democracy has no parallel in the Middle East. The shared values and inter-community loyalty that made Switzerland successful aren’t present for a cantonalized Iraq.
I believe that the underlying issue for most Middle Eastern countries is that due to the interaction of colonial history and culture, they are generally low-trust societies, meaning that the people tend to rely more on familial or “tribal” bonds rather than more abstract adherence to the rule of law or loyalty to one’s nation-state. Francis Fukuyama wrote a great book, unsurprisingly titled “Trust” in which he explores the concept in some detail and I think it is a very useful lens with which to examine the knotty details of state-building.
In the Middle East, nascent multi-faith democracies have struggled with competition and rivalry. Think Lebanon, the civil wars in Yemen and the oppression/suppression of Shia majorities in Bahrain and the Gulf coast of Saudi Arabia. Likewise, the Shia Arab population around the Shatt-al-Arab has been viewed as a stalking horse for the “other” on both sides of the river — “untrustworthy Arabs” on the Iranian side and “Persian slaves” on the Iraqi side. Going back to the Swiss example, it must also be remembered that competition between the Protestants and Catholics was fierce and that the word “ultramontane” can still raise Swiss hackles.
The first step for Iraq and other post-colonial Middle Eastern states is to determine that being in Iraq or Jordan or what-have-you is the preferred expression of national identity. Assuming that question is answered in the affirmative, a democratic form of the nation-state which permits a full and free national life for all groups within the state needs to be established.

In Iraq, the Kurds currently have a canton-like zone of influence in the far north (the Kurdish Regional Government or KRG). However, they are pressed upon in many ways by all their neighbors. The Turks view any formal Kurdish entity as a threat to their national sovereignty. The Sunni Arabs feel roughly the same way, and, at a minimum, want to push the Kurds back into the mountains and away from the oil fields at Baiji and Kirkuk. For their part, the Kurds have already voted in favor of independence, but the Iraqi state viewed the referendum as illegal. Other regions in Iraq can, in theory form autonomous regions akin to the KRG but none have yet done so.
Brookings has a good report on sectarianism and the problem of devolving power in Iraq called “Sectarianism, governance, and Iraq’s future.” This gives a useful survey of the issues faced by that country in the wake of three major wars and a despotic dictatorship over the last 50 years.
Well, this was much longer than I intended. I’ll have to write about Afghanistan another time!