Postgres: extracting multiple bit-columns from single 'flags' column after join with 2nd table
You could merge the subqueries using this model:

SELECT bool_or(B.tags&amp;1&lt;&gt;0) as "has_children_tag_1",
       bool_or(B.tags&amp;2&lt;&gt;0) as "has_children_tag_2",
       bool_or(B.tags&amp;4&lt;&gt;0) as "has_children_tag_3",
       bool_or(B.tags&amp;8&lt;&gt;0) as "has_children_tag_4"
FROM A LEFT JOIN B ON A.id = B.parent_id
WHERE [conditions]


bool_or is an aggregate function that evaluates to true if at least one value is true, so that should lead to the same results as the multiple count(*)&gt;0 in the question, except as one single subquery.

To push these columns into an otherwise unrelated query, you may add the above subquery as a CTE in a WITH clause, and just put it in the FROM list. For instance, modifying your original query:

WITH flags AS
(SELECT bool_or(B.tags&amp;1&lt;&gt;0) as "has_children_tag_1",
       bool_or(B.tags&amp;2&lt;&gt;0) as "has_children_tag_2",
       bool_or(B.tags&amp;4&lt;&gt;0) as "has_children_tag_3",
       bool_or(B.tags&amp;8&lt;&gt;0) as "has_children_tag_4"
FROM A LEFT JOIN B ON A.id = B.parent_id
WHERE [conditions] )
SELECT 
  id, 
  aaaa, 
  bbbb,
  tags,
  has_children_tag_1,
  has_children_tag_2,
  has_children_tag_3,
  has_children_tag_4
FROM flags,A
LEFT JOIN Z
    ON A.id = Z.id