So I've just experimented on my end, based on Ubuntu 20.04, without the Python 2 environment (and hence no python binary in $PATH), I got the following

npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack     at PythonFinder.failNoPython (/root/parts/joplin/build/packages/tools/node_modules/node-gyp/lib/configure.js:484:19)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/root/parts/joplin/build/packages/tools/node_modules/node-gyp/lib/configure.js:406:16)
npm ERR! gyp ERR! stack     at F (/root/parts/joplin/build/packages/tools/node_modules/node-gyp/node_modules/which/which.js:68:16)
npm ERR! gyp ERR! stack     at E (/root/parts/joplin/build/packages/tools/node_modules/node-gyp/node_modules/which/which.js:80:29)
npm ERR! gyp ERR! stack     at /root/parts/joplin/build/packages/tools/node_modules/node-gyp/node_modules/which/which.js:89:16
npm ERR! gyp ERR! stack     at /root/parts/joplin/build/packages/tools/node_modules/isexe/index.js:42:5
npm ERR! gyp ERR! stack     at /root/parts/joplin/build/packages/tools/node_modules/isexe/mode.js:8:5
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp ERR! System Linux 5.8.0-63-generic
npm ERR! gyp ERR! command "/snap/node/5252/bin/node" "/root/parts/joplin/build/packages/tools/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /root/parts/joplin/build/packages/tools/node_modules/sharp
npm ERR! gyp ERR! node -v v16.7.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

This was a pretty huge hint, so I set $PYTHON = python3, and then I got the same error as you did above. I tried again with both Python3 and Python2 in the environment, but `PYTHON=python", and in this situation the build worked properly.

So it seems to me, Joplin does have a strict build dependency on Python 2 which might be going un-noticed generally for the time being, but probably wants looking at given as you say, it's well past being EOL.

For the time being, it looks like you could set the PYTHON variable to point to a sideloaded Python2 installation and maybe it'll fix this for you, or potentially modify $PATH so that python == python2 for the Joplin build specifically. It's not the mix of Py2 and 3 generally that is breaking it, but probably just an odd instance of something having a specific dependency on Py2 and assuming it's simply python.