There is no flaw.
If a group of people doesn't want to be governed by a certain body they should have the right to secede.
A government derives it's right to rule by the people accepting this rule.
Obviously this is a really hard problem and it opens up the door for all kind of abuses, but ultimately democracy demands that. Democracy first needs a demos. A group of people who feel connected by whatever reason they like and agree to form a community. If the borders of the community are not drawn by the community itself, it's not democratic. Just look at all the wars being fought about borders which were drawn by colonial forces and didn't respect the locals.
In this I also see the power of parliament's and federal states - even if your vote don't win the election, you are still represented in parliament and you have the local gov. Without that, it would be hard to keep regions where a majority voted different than the whole nations majority.
Globalism, neo-liberalism, individualism - all that severely reduced the solidarity people have which each other. The internet then connected us with people that we share much more with than just area. All nations, democracy as a whole will have to face this tremendous challenge. And I have no idea how.