ViMish It is not glitching, you are just simply pushing it beyond the capabilities. The OIS is meant to counter natural movement of your body and also, to some extend, heavy winds which prevents you from keeping your phone stable. When you are shaking your phone like that, you are completely overloading the OIS, it just can’t counter such extreme, rapid movements.
The EIS (electronic image stabilization) kicks in and tries to save the day, but again it can’t perform any miracles and is overwhelmed, leading to the “glitches” you are witnessing.
I don’t see anything wrong with your phone so far.