There's a lot that could be discussed here because your question effectively asks about the widely discussed and disputed relationship of European nations and the sovereignty they may or may not have ceded to the EU and ECHR especially with regards to fundamental rights in national constitutions.
There is no simple answer here, but I'll start with the general question of whether the ECJ can overrule a Member State's constitution as that's what I'm most familiar with.
Primacy of EU law
ECJ case law is clear and long established. EU law has primacy over national law and this includes their constitutions. Costa v. ENEL is an early landmark case:
It follows from all these observations that the law stemming from the treaty, an independent source of law, could not, because of its special and original nature, be overridden by domestic legal provisions, however framed, without being deprived of its character as community law and without the legal basis of the community itself being called into question.
And more explicitly, in Internationale Handelsgesellschaft where potential conflict with the German constitution was at hand:
Recourse to the legal rules or concepts of national law in order to judge the validity of measures adopted by the institutions of the Community would have an adverse effect on the uniformity and efficacy of Community law. [...] Therefore the validity of a Community measure or its effect within a Member State cannot be affected by allegations that it runs counter to either fundamental rights as formulated by the constitution of that State or the principles of a national constitutional structure.
However, the treaties do not explicitly state this position in any substantive Article. The closest we have is a declaration attached to the Treaty of Lisbon:
The Conference recalls that, in accordance with well settled case law of the Court of Justice of the European Union, the Treaties and the law adopted by the Union on the basis of the Treaties have primacy over the law of Member States, under the conditions laid down by the said case law.
In practice, this has left enough room for Member States to disagree with EU primacy (though some, like Ireland, explicitly place EU law above their own constitutions leaving no room for such conflict).
So what happens when a Member State's highest constitutional court affirms national constitutional law in contradiction with EU law? The legal answer is really just restating the facts: According to the ECJ, EU law sits above and displaces contradictory provisions of a national constitution. According to the relevant national constitutional courts, EU law in contradiction with the national constitution cannot be enforced.
The reality is, this isn't a legal question. In theory, this is a question that would have to be resolved politically, and in practice the answer is whichever side ultimately enforces their interpretation.
Example EU case law
Historically, examples of the ECJ directly overruling a nation's constitution are extremely rare, in part due to similar legal traditions resulting in generally compatible constitutions, and in part, a (speculative) desire to avoid such open conflict if possible.
However, recently this is an area of law that has flared up recently in many Member States. I'll gloss over a few examples I'm somewhat familiar with.
Germany – the Solange cases
In the above cited Case 11/70, the European Community (as it was then) court upheld its own law against the German court's concerns of it violating fundamental rights in the German constitution. When the case returned to Germany, the German Constitutional Court refused to accept the result, saying that as long as the Community did not guarantee fundamental rights, they would not enforce the law in contradiction with the German Constitution. In German law, this case if popularly referred to as Solange I, German for "as long as."
Sixteen years later, the German Constitutional Court evidently felt the condition had been satisfied in Solange II and gave new meaning to solange. They said that as long as basic fundamental rights were respected, they would no longer be regularly reviewing EU law for compatibility with the German Constitution. Note that the court clearly left the door open for future review, though this would not be the default position.
So that brings us to Solange III. Here the court did walk back on Solange II a bit, asserting that when implementing EU law, it would in fact review compatibility with the fundamental right of human dignity. That said the court then sidestepped the review in the case at hand and furthermore did not refer a question to the ECJ, thus not enabling a European response. See The Bundesverfassungsgericht’s human dignity review by Clara Rauchegger (2018) for a good review of Solange III and the case law it builds upon.
That article points out that Solange III may have had an additional purpose: ensuring the court re-asserted its authority for a potential upcoming battle against the European Central Bank. This came to be as the court ruled an ECB program invalid in Germany despite earlier approval by the ECJ. The Commission threatened legal action through dropped the matter a few weeks ago after German government assurances that they would comply with EU law. However as Politico notes:
It remains, however, uncertain how the German government could provide such an assurance, given that it has no say over the constitutional court, which is an independent juridical body.
Italy – the Taricco cases
This ones more complicated, here's a thorough analysis which I'll try to summarize. I'll cite an analysis on for reference. The dispute centred around retroactivity of criminal statutes of limitations and legal certainty. In Taricco I, the ECJ ruled that the limitations for VAT offences was too short and was therefore to be disregarded by national courts. This triggered a bit of a constitutional crisis in Italy: The EU (and ECHR) perspective is that limitations periods are merely procedural and extending them does not violate guarantees against retroactive criminal penalties. This is not the case in Italy where limitations periods are substantive, and lengthening them cannot be done retroactively.
So the ECJ, perhaps without realizing it, ordered Italian courts to disregard Italian constitutional protections. The ensuing chaos triggered the Italian Constitutional Court to send a second reference, Taricco II on effectively the same legal question amidst calls for the ICC to disregard the ECJ ruling, much as the German courts did in Solange I. However, the ICC did add a direct question to the ECJ on the subject of EU law primacy, one which the court opted not to answer.
The ECJ's resolution was ultimately to accommodate the Italian criminal law peculiarity while not dismissing it's earlier ruling. It essentially subordinated its earlier ruling to only apply when fundamental rights would not be violated. Essentiatlly while the ECJ continued to hold that the Italian limitations period was too short, the courts could not infact disregard the limitations period as it would violate Italian fundamental rights. It is instead for the Italian legislature to resolve the incompatibility (presumably by introducing longer limitations periods non-retroactively).
Poland and Hungary rule-of-law
With respect to Poland, and more recently Hungary, the legal situation is very much ongoing and developing. According to the BBC, Poland's constitutional court had earlier declared their that EU law does not have primacy over their constitution. Then in a related case, the ECJ imposed a 1 million Euro daily fine on Poland for violations of the judicial independence of their own judges. I couldn't find information on whether they are actually paying the fine, but they were already refusing to pay an early 0.5 million daily fine.
This dispute is very much still ongoing and the Commission has now sent letters to both Poland and Hungary where withholding of EU funds due to rule-of-law violations is a possibility. They have until mid-January to respond. Complicating the legal picture somewhat is that many thought the Commission was very slow to act on this matter. Among them was in fact the European Parliament who have initiated a lawsuite at the ECJ against the Commission on their failure to invoke the mechanism for withholding funds.
Briefly, ECtHR
Note: I'm using ECtHR for European Court of Human Rights to distinguish from the ECHR I use later for the European Convention on Human Rights, which is the treaty the ECtHR adjudicates.
I'm much less familiar here, but the principles are the same. The ECtHR decision are in theory binding on its members according to the ECHR, but enforcement is even more difficult. For example, the Constitution of Bosnia and Herzegovina adopted in the aftermath of the Bosnian War reserved certain political positions to specific ethnic groups. In 2009, the ECtHR found this to be a violation of human rights, but this has yet to cause any constitutional amendment.
Technicalities in bringing a case
Could the ECJ or the ECHR [...] allow for a member of the opposition or a newly elected government to challenge the legality of the de facto constitution?
For both courts, this challenge is indirect. At the ECJ, an individual cannot unilaterally bring a challenge to national law (the lower General Court allows individuals to bring actions against EU institutions, but not national ones). They must bring the challenge at national courts, who would then refer questions of EU law to the ECJ as necessary. At the ECHR, domestic options must be exhausted first. In practice this means that at minimum, appeals must be exhausted in the national courts first, but then a case could be filed.
Specifically for your example of the situation in Hungary, a more realistic scenario at the EU would be for the European Commission to file a case against Hungary, like it has for the issues with Polish judicial independence.
I'm speculating for the ECtHR, but my impression is that this is not a viable option. There would be enforcement problems, a case would certainly take a while to get heard due to large volumes, and I am not convinced there's a ECHR violation described in your question. An individual would have specifically have their personal human rights violated, I am unconvinced that the tweaks to the election system described would amount to a ECHR violation, especially if people are still allowed their democratic vote (this is my theoretical guess, I'm too unfamiliar to hazard a guess on the practical situation).
Result of judgment declaring conflict of laws
Again, the issue is one of enforcement. For both ECJ and ECtHR, their decisions do not necessarily directly and immediately render national law inoperable in the same sense that eg. the US Supreme Court does when it declares a statute to be unconstitutional (though again, some countries have indeed arranged their constitutional structures that way).
Specifically for the ECJ, if it finds contradiction with EU law, it will issue a declaration along the lines of "this EU legal provision precludes national law that says X". The case at hand is then returned to the national court for further proceedings, and for it to resolve the conflict of laws in accordance with national procedures.
One interesting national procedure was that of the UK before it left the EU. Due to the principle of Parliamentary supremacy, its courts cannot generally invalidate Acts of Parliament. However, courts interpreted s. 2 of the European Communities Act 1972 as granting them permission to disapply statutes in conflict with EU law.
On the ECHR side, powers of the UK courts are weaker. The Human Rights Act 1998 gives them the power to issue a declaration of incompatibility. This does not invalidate UK law and is merely a notification to Parliament that there exists an incompatibility with the ECHR. See Benkharbouche/Janah v Sudan Embassy/Libya for an example of both disapplication and a declaration of incompatibility (on the same legislation, which seems a bit redundant to me).