There's two main options to approach this: either you inject into the game like how MangoHUD does it, or you make an overlay window that your window manager/compositor helpfully places on top for you.
The second option is pretty simple as any GUI library will give you the window, you just need some help from the compositor side to do the rest. That part can also be pretty easy thanks to Wayland nesting: you can use whatever compositor you want for this, not just the one from your DE. Gamescope for example might work, if not wlroots+layer-shell.
You can also be your own nested compositor by using Smithay, which is in Rust and was made by System76 to be the library behind COSMIC's compositor. Looking at the examples, it looks not too crazy to use. Then you just run the game under yourself and you can do whatever you want.
Injecting into the game isn't too crazy either, you compile to a library and force load it with LD_PRELOAD and override some OpenGL/Vulkan functions that lets you add your own draw commands on top before the frame is finished.
I think avoiding injecting into the game is cleaner and easier as you're completely independent from the game client, so you won't crash the game and you can also just test out your code as a regular window, and restart it mid game. Injecting would also trigger anticheat if present. Which, what you're doing kind of is, even though anyone could also just pen and paper it.