API: fix corner case of lib.infer_dtype
- [x] closes #23421
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Working towards #23167 needs fixing of the type inference for some corner cases (especially not inferring an object column full of NaNs to be `'floating'`).
