There’s already a wayland protocols extension in “testing”, called ext-session-lock-v1 [1]. Sway, river and other wlroots compositors already support it.
The ext-session-lock-v1 protocol is significantly more robust than previous client-side Wayland screen locking approaches. Importantly, the screenlocker crashing does not cause the session to be unlocked. [2]