BUG&TST: df.replace fail after converting to new dtype
- [x] closes #31517 
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


This was solved by #31484 and here add a test to prove it works now, and thus close the issue, i think a whatsnew is not needed in this case thanks @charlesdong1991 

backporting this to ensure that 1.0.x is tested as well.