For me the root cause of the issue was that "Use legacy console" was enabled in the windows command prompt (which I was not even using).
The file %USERPROFILE%\AppData\Local\rancher-desktop\logs\wsl-exec.log
had a statement about that (I cannot paste it because after fixing the problem, the log was wiped)
This page has the instructions on how to disable the legacy console mode: https://winaero.com/bash-in-windows-10-fix-unsupported-console-settings/
The instructions are for windows 10, but they worked in windows 11 for me as well.