How to lock the view to the XY, XZ, or YZ plane
There's the Toggle Quad View option, which has such functionality.
It splits your viewport into multiple views, that cannot be rotated.

View > Area > Toggle Quad View
Shortcut: Ctrl + Alt + Q