I don't think so, it's not current active transactions, but number of active transactions on the CURRENT CONNECTION. No way you get that from pg_stat_activity. So if your proc had a bunch of embedded BEGIN/END blocks, it would be that count.
David G. Johnston wrote on 5/29/2021 10:44 AM:
One transaction per process actively executing a query.