I wonder if there exists, at least in plans, a centralized system that examines editors' decisions in journals, a kind of "appellate court" in peer-review publishing.
In cases of unethical behavior, professional societies can investigate a journal, but your description includes nothing that appears unethical.
In most of those trials the paper was rejected without going to peer-review, but editors didn't point out specific flaws. Instead, they used general statements like "your paper is certainly interesting, but we get so many even more interesting papers, so unfortunately we cannot publish yours".
This may be frustrating and reflect genuine bias against your ideas, but it's a reasonable and standard way to run a journal. Some sorts of bias are unethical (for example, discrimination based on the author's race, ethnicity, gender, etc.), but intellectual bias is almost unavoidable. There are a few journals, like PLOS ONE, with the mission of publishing anything that's new and not clearly defective, but most journals try to filter based on interest and importance. That necessarily involves judgment calls by the editors regarding what is likely to be satisfy these criteria. In particular, part of running a prestigious journal is favoring some topics and approaches over others, and the community judges the editors based on how well they manage to select interesting and important papers. To reject a paper without review, there's no need to identify a flaw. Instead, the editors can simply decide that it's not interesting or promising enough to justify the effort of formal reviewing, or that the chances of acceptance are low enough that sending it out for review would just waste the reviewers' and authors' time.
In one journal the editor simply replied that the paper is out of the journal's scope, which is plain-out false (the paper deals exactly with one of the major topics of the journal).
Scope can include both subject matter and approach. Some journals like to publish controversial papers that may well turn out to be wrong or misleading but will at least lead to interesting discussion and follow-up work. Other journals are more conservative and have no interest in going out on a limb with a risky theory that reexamines what the editors consider to be well-settled science. I don't think the editor in your case was lying to you about the subject matter scope, but rather indicating that your paper is outside the scope of the type of work they want to publish.
In another journal the editor passed the paper to peer review. In two months it was rejected "in view of reviewers' comments". But - amazingly! - all reviewers recommended publication, with certain revisions.
This is an awkward issue, and it would have been helpful if the editor had clarified. (E.g., "While the reviewers' comments were largely positive, the editorial board felt that they did not make a strong enough case for publication in comparison with other recent submissions.") But I can appreciate the editor's position. Sometimes you get a submission that is unusual and unconventional, one you know a lot of the community won't like. Who do you choose as reviewers? You can predict many people's opinions in advance, which introduces an intrinsically political aspect (if you want to kill the paper, it's easy to choose conservative reviewers, and vice versa). One approach is to ask sympathetic, open-minded reviewers but hold them to a high standard by seeing whether they can convince you to accept. The question isn't whether they recommend acceptance, and in fact the editor may know in advance that they have a soft spot for this topic. Instead, the question is how compelling and forceful a case they are able to make for this specific paper.
Of course I have no proof that this is what was going on here, but I'd bet it was. If the editors were determined to kill the submission, they would have rejected it without review or deliberately assigned unsympathetic reviewers. Instead, I think this journal gave you more of a chance than any of the other six.
Could anyone give any recommendations as to how to safeguard oneself against unethical situations like those described above?
As I explained above, I don't think these situations are unethical, but they are still worth avoiding. One factor to consider is how often a journal publishes unorthodox or unconventional work (even if it's not on your exact topic). If they sometimes do, then they are likely to give your paper a fair hearing. If they rarely or never do, then that's probably because they are reluctant to do so.