Who came up with that structure?
Inherent complexity.
You see, it's hard to know in advance all consequences of today's decisions. A person or a political body may have all good intentions, yet with time passing, rules which seems unambiguous and good suddenly are viewed in another light. Many rules can be applied technically correctly, but contrary to the ideas there were when the rules were created.
Sometimes the consequences are seen - there's just no way to avoid them, short of skipping the rulemaking. Sometimes they are not. It seems like legislation, while on the surface similar to software making - only for humans, not computers - in reality works with critically different constraints. That is, computers are relatively easy modeled as systems with clear set of states, while human societies are not.
One may play with the idea to require to attach to every law at the moment of enacting an informal, but complete, as it is feasible, explanation for why the law is created, what its intent and limitations. This will probably won't always work; it may shift problems elsewhere with application - interpretation - of laws though.
Coming back to your question - do you see this scenario you described as visible and deserving attention at the time EU rules were made?
History of Spain reports more than fifty general elections before this date, starting at 1810. Is a fact well documented and impossible to ignore, unless you want to rewrite the history of the country in the last 200 years for some reason. The universal concept of democracy, of course, has changed with time but this was not exclusive from Spain.
https://es.wikipedia.org/wiki/Anexo:Elecciones_en_Espa%C3%B1...
They can do things like block the Hungarian govt's access to EU funds, bring a case to the European Court of Justice, etc.