Did you access the Ubuntu file system through Windows Explorer? Did you access any file on the Ubuntu file system from Windows?
If yes, you likely corrupted something, because these random errors are typical behaviour for that.
I suggest you should wipe the old WSL installation and install a fresh and new WSL.
Running Debian 11 Bullseye on WSL myself, everything runs perfectly fine. No issues like that, at all. I specifically tested your examples and they all work flawlessly.