Wrapping OR with NOT yields unexpected results

I have filters for tasks. As I also use the todo tag for things i want to read and watch, I additionally tag those tasks with “article-queue” and “video-queue” respectively.
For some reason filtering for these tasks (i.e. showing only these tasks) works fine. But excluding these from all my other task lists doesn’t. I am trying to build a query that acts as an “inbox”. It should exclude tasks that have priorities set, are on the page “templates” and those that reference all pages that end with “-queue” or rather “-stapel” as I actually named them.
As I stated, positive filtering works fine. As soon as I wrap the OR condition with not, the conditions in the OR statement are ignored, it simply lists all tasks in my database.

Here’s what I used:

Tasks lacking metadata:
{{query (and (task NOW LATER DOING IN-PROGRESS TODO) (not (or (priority A B C D) (page [[template]]) "-stapel")))}}

Without the NOT it shows precicely what I would expect.

Ideally it would also filter out those tasks that have a scheduled date assigned to them.
And since I have your attention: Subtasks clutter my lists aswell. If you know any means to filter those out, let me know!

Thaks for helping out! Actually the explanation provided by Siferiax does make sense. And most importantly: the new query works!

Will have a look into advanced queries. Up until now it seemed to complex for me but decluttering the todo list becomes more and more important so I will have to dig into this.