[v14.x] Backport Python 3.10 compatibility patches
Backport of https://github.com/nodejs/node/pull/40296.
Required to fix the Windows CI with v14.x-staging
. Conflicts were due to v14.x
supporting fallback to Python 2 if Python 3 is not available.