Polynomial functors and W-types for groupoids