(Oops, I deleted my comment.) Should there be an assert here to ensure that plugins are != null if wrapForGSTPlugins is true?