Track pipeline groups using a shared reference counter instead of a linked list. (cherry picked from commit 513afd33)