(I'm the author of the original post [1]) And while I think the rules, in the end, make sense, I think it's not quite as clear cut as you describe, consider:
SELECT (SELECT sum(1) FROM xx LIMIT 1) FROM aa;
which returns 3
3
3
Personally, I think having the inner aggregation always attach to the nearest `SELECT` would have been an equally valid way of defining how this works, but it just so happens it is not defined that way.[1]: https://buttondown.email/jaffray/archive/sql-scoping-is-surp...