BUG: unexpected merge_ordered results caused by wrongly groupby
- [x] closes #38166
- [x] closes #38167
- [x] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry
