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