I think I found the issue, i think the issue is that Unity 2022.2.0f1 is shipped with a newer version of Emscripten. When I replace it with the version that is inside Unity 2022.1.23f1 it builds for me within a few minutes. Emscripten can be found here:
2022.2.0f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten
Most likely it is only the wasm-ld.exe that is faulty. But I just replaced the complete Emscripten folder to be sure confirm.
I think only replacing the llvm folder inside the Emscripten folder is enough. But I could be wrong.
The faulty version is: 14.0.1.0
The working version is: 13.0.0.0
Can anyone reproduce this same behavior?