For another, postgres has more JSON functions than just jsonb_agg.
https://www.postgresql.org/docs/current/functions-json.html
I don't have time to write something out right now, but there are definitely options.
It's kind of a red flag, though, that you didn't answer my question about how you would restate his main argument. It suggests to me that you're just here to flame instead of to have a productive discussion.
I kind of thought it was a red flag that you were accusing me of not understanding the post, which is about how SQL is bad at hierarchical data, while defending the bad SQL he used to defend his argument. But I didn't make a big deal out of it.
> I'm not sure there's a better option in Postgres, and I'm not convinced you understand his main argument. How would you restate it?
Rather than asking you to demonstrate the better way of writing the query.
I think you don't understand what the post is about, you don't understand what the query is trying to achieve, you don't know a better way to do it, and you're just engaging in ego defense instead of contributing anything.