Avoid an n+1 query problem and fetch the bundled aggregations for m.reference relations in a single query instead of a query per event. This applies similar logic for as was previously done for edits in8b309adb43(#11660; threads inb65acead42(#11752); and annotations in1799a54a54(#14491).