The EU is far from "perfectly functioning". It functions pretty well but it's not perfect. There's some non-negligible group in pretty much every country that rightfully has some major gripe with the EU. If there wasn't we wouldn't have things like Brexit. I get that you can't please everyone but if the UK GTFOing isn't indicative of some sort of imperfection than I don't know what is.
This is so deeply wrong it's offensive.
The EU is co-ruled by an opaque system of non elected bodies, under the table deals, and backroom diplomacy.
And those are mostly official establishment narratives -- if you look at critiques from the left (and libertatians) the picture is much much bleaker.
The EU council (comprising of democratically elected heads of government from the 28 member countries)
The EU parliament (comprising of directly elected MEPs from the 28 member countries)
The EU commission president, nominated by the council, approved by the parliament, and standing on a ticket to be EU Commission president during the parliamentary elections
The EU commissioners, appointed by the democratically elected heads of government from the 28 members
Laws are only passed by agreement by the democratically elected council and the democratically elected MEPs.
In actual EU, decisions are made by informal bodies like the Eurogroup, meeting under close quarters and with no documentation, with economic and diplomatic pressure from top dog countries, with satellite states vote how their sugar daddy states ask them, and a whole lot more besides.
Representative democracy, with it's paltry accountability except every 4 years, gerrymandering-schemes (not a US-only problem), typically revoked election promises, backroom talks, corruption, and private interests paying politicians is already undemocratic enough as it stands.
And suddenly removing the voters even further (as in the EU Commission), or adding "bodies" with no officially defined role and protocol, and closed discussions, like the Eurogroup, is "democratic" because those involved were "democratically elected finance ministers" under unrelated to the EU national elections.
With the EU, the process is formalized, opened up for scrutiny at many levels (sure, they could be more, there are people working on that problem), and then everyone can have a say through the European Court of Justice process.
The fact of the matter is that we live in an increasingly globalized world, and we must find ways to live together without resorting to the traditional genocidal ways (which are now practically unsustainable - a serious war on the continent would produce hundreds of millions of casualties). Somewhere, the political sausage-making has to happen.
So just like any other democracy in the world. Do you really believe things are different in the House of Commons or the senate?