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