How to lock vertex to axis during bone rotation?
Consider setting the deforming bone option Relation Parent [Inherit Rotation] False as depicted below.  The bone will still be moved by parent movement.



Here a parent bone is rotated.  Parent bone set to [deform] False.  This is an attempt to emulate your images in the question.



Below a bone constraint.



You can restrict bone axis movement.  In general restrict bones rather than vertices.

The default armature automatic weights were accepted.  Weight paint mode below.



The vertex density supports the curved images.