Just thinking out loud here now:
• Setting up a move mouse action within in a loop would lock the mouse in place. Something similar to what I demonstrate here: https://forum.keyboardmaestro.com/t/lock-mouse-while-macro/26847
• Mouse clicks might be harder to avoid/swallow, but if the pointer is locked all the way to a corner or something it shouldn’t really matter.
• As for the keyboard, activating a macro (or group containing a macro (or macros)) with Hot Key Triggers for all keys and key/modifier combinations of the keyboard should swallow all keystrokes (the macro would do nothing but swallow all the keystrokes). Cumbersome to set up, but I believe it should be quite effective.