Initially, it was just a few hundred merchants and peasants banding together and using home-made poles with sickles on the ends to fend off armored knights. But by the end of the rebellion thousands of people from dozens of hilltop villages had joined together.
That kernel formed an informal alliance that grew into Switzerland over time.
Even today, the various Cantons see themselves as kind of independent of each other. They copied the US constitution, but while the US became a more centralized and despotic state ... the Swiss kept the original federalist design of the US constitution.
Individual cantons have their own public or private health systems. They have their own education budgets. There is a huge amount of variation between the cantons. And basically Switzerland refuses to join most European efforts to disolve national boundaries.