BUG: groupby.transform confused about index
Under some circumstances, `transform` is getting confused about what the output index should be:

```
>>> df = pd.DataFrame({"c1": [1], "c2": [2]})
>>> df
   c1  c2
0   1   2
>>> df.groupby('c1').transform(sum)
   c2
0 NaN
1   2
```

I haven't chased down why, but since we have

```
>>> df.groupby('c1').transform(lambda x: sum(x))
   c2
0   2
```

it must be another fast-path problem, like #9697.
