ERR: Raise the correct error for to_datetime()
- [x] closes #23830
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Verified that it does not affect the fixes by #19529 (for issue #19382)