BUG: Bug in DataFrameGroupby.transform when transforming with a passed non-sorted kye (GH8046)

closes #8046