When you twist your wrist to the right, that is called ulnar deviation. When you twist to the left, that is radial deviation. This is bad for two reasons:
Have you ever cut a branch off a living tree then bent the branch left, then right several times until it starts to crease, then crack then splinter? Your tendons run through a sheath which is lubricated with synovial fluid. When you bend your wrist like that, you can indeed create little cracks in the sheath and synovial fluid can leak out causing ganglion cysts aka bible bumps.
The second thing is that that twist robs you of the power or the weight of the arm behind the finger. Have you noticed that your four and five fingers seem weak? They are weak because the forearm is not behind them most of the time. They require subtle adjustments of the arm (elbow) to align the arm behind them for power and speed.
Also, that twist and awkward change of direction will hinder your technical ability, especially when you try to play fast. You are trying to play UP the keyboard but the sudden twist pulls your arm downward. That sort of pull will hinder your technical growth and also make the black keys feel high and heavy.
You need to find a new teacher who won't let you get away with these in-ergonomic movements. You need to get your playing into your arm, not the fingers. The arm places the fingers where they need to be through an amalgamation of up, down, in, out and forward shifts of the arm. If you have seen pianists who look effortless or very graceful, it is because they are not playing in static motion but utilizing dozens of muscles at the same time to give the fingers, arm, wrist their shape. Some teachers even call it shaping. I beleive this is the first lesson in the "Russian School of Technique" and the student spends a few weeks just exploring "grace."
Wash a window, wax a car, pet your dog, write on a chalk board . . . notice that the arm places the hand. That is how you should approach the piano. Play from the fingers and either you will be mediocre at best or put steak on the table of a surgeon.