Hello,
An other solution is to expose nested queryid, and to join it with pg_stat_statements.
Actual development trying to add queryid to pg_stat_activity isn't helpfull, because it is only exposing top level one.
Extension pg_stat_sql_plans (github) propose a function called pg_backend_queryid(pid),
that gives the expected queryid (that is stored in shared memory for each backend) ...
Regards
PAscal