There are many levels of government from local to multinational. At most one of those levels can be sovereign, and democracy makes most sense on that level. On other levels, some degree of democracy is possible, but it's always subject to the consent of the sovereign state.
EU member states have voluntarily agreed that in some situations, EU law takes priority over national law. But because the member states are sovereign, it's up to them to decide how to proceed when EU and national laws are in conflict. The EU has only limited means to sanction member states that breach their laws. It cannot arrest and prosecute German lawmakers. It can't declare German laws invalid, except to the extent German institutions voluntarily follow EU rulings. It can't forcibly rewrite German laws. And in extreme situations, it can't declare Germany's Constitution unconstitutional and invalid, and it can't forcibly rewrite it.