This file needs setuptools. It isn't stdlib, so it now needs to be explicitly listed as dependency.
https://github.com/py-bson/bson/blob/master/setup.py
In 3.12 you can't expect it to automatically be available.
python/cpython#95299
I was able to successfull install after adding setuptools to my pyproject.toml. I didn't investigate other scenarios.