BUG: incorrect output of first('1M') in case if first index is the last day of the month (#29623)
- [ ] closes #29623 
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry
