Did you set an rpath, reconfigure ldconfig, or LD_LIBRARY_PATH env var? If not then you compiled Python with an alternative OpenSSL installation but did not instruct the ld to load the alternative shared libraries. --with-openssl only modifies header and linker search, not dynamic loader options.
The command
ldd $(find build -name '_ssl*.so')
will should you what shared OpenSSL libraries the dynamic linker will load.
I wrote a script to download and compile OpenSSL and then run Python's test suite with exactly that OpenSSL build:
./configure
make
./python Tools/ssl/multissltests.py --openssl=1.1.1g