The code was wrong and didn't work on systems with OpenSSL compiled without ripemd160 (which is now the case for the OpenSSL 3.0 default build), because the try except clauses were not properly nested.
It should have been:
try: ... except ValueError: try: ... except ImportError: ...
The last fallback option, which is a slow pure-python implementation (slowdown very noticeable in wallets with many addresses), is no longer really needed as we just made pycryptodomex an official dependency.
Note that we also have a (better maintained) ripemd pure-python implementation in the node's test framework, so this also deduplicates code in the monorepo.
Depends on D14132