Just the other day I was wondering - what would it take to develop a Linux WM in Godot?
It bas been done :
https://github.com/SimulaVR/gdwlroots
But it is not up to date with Godot 4. You can have your Firefox or Blender window be a regular texture inside a full Godot game, pretty crazy...
For example, wlroots: "Pluggable, composable, unopinionated modules for building a Wayland compositor; or about 60,000 lines of code you were going to write anyway." So it would also depend on if you mean raw WM or if you want compositing also etc.