TST: GroupBy(..., as_index=True).agg() drops index 
- [x] closes #28641
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

While searching for related issue for my other pull request, I found that this issue must have been fixed with another commit in the past (don't know when this issue was fixed).

I added a test to ensure that this error won't know occur in the future.
Mind merging master? Failing test should be fixed  Merge master looks fine, can you merge master and ping on green. thanks @phofl 