This is one of those instances where slow methodical practice for maybe three weeks (with nothing else) will fix the problem. You've already hardwired the extension into your brain and now you have to undo it. Then, you have to undo it again when you begin to speed up.
If you took HS physics, you know that every motion has an equal and opposite motion. Swing a bat, a club, a fishing pole, kick a ball, throw a ball, swat a fly, throw a punch - they all start with opposite motions. Even when walking in order to move forward your opposite foot is pushing backward. Walking up stairs, your ascending foot raises higher than the step then comes straight down onto it. It is a law of physics, you can not break it. Well, you can but it will break you. Most injuries of all kinds are when we break laws of physics and gravity. Since the black keys are higher than the white ones, when playing a scale, it is imperative to have an UP somewhere.
In order to play down on the piano there must be an up motion first. Hanon thought he could achieve that by isolating fingers and raising them high. That often forces issues like what you are complaining about. You can't use both extensors and flexors at the same time. Lucky for you you know this.
Slowly wave bye bye with all five fingers and it should feel effortless. Now isolate your index finger and wave with just that one. You might feel tension in your long flexor tendon. That is because it is being pulled in two directions simultaneously. Two muscles pulling on one bone. One will win, both will cramp or, the tendon caught between the two can inflame from being overstretched. If you have cramps, your teacher might say "relax." But, relax WHAT? You can't relax the muscles your are trying to use so what can you substitute?
In order to achieve "up," you can use the fulcrum of the elbow and bicep to just raise the hand. You can also use the pronator and supinator around the elbow to raise the hand laterally. There is also forward shifting. The goal is to keep all five fingers together at all times. When one goes down, they all do. When one goes up, they all do. Some teachers call this "tapping."
The power to play the piano comes from the combination of several muscles and not using others. The use of the arm weight and gravity is primary. If the arm plays the finger, then you can truly relax your flexors and extensors (the fingers have no muscle).
The goal then is to minimize the movement so it all looks effortless. If you have ever seen graceful pianists play with a lot of slow up motions, they may not necessarily be trying to look graceful, they are feeling the weight of the arm, finding gravity so they know how fast and where to place the finger.
If you experiment with playing by arm weight, remember to never ever, ever, ever, ever, ever press into the keybed. If you are pressing down, you can't lift up. And, you'll get tendonitis. After hitting the point of sound you "rest up" leaving only enough weight to keep the key down.
Go pet a dog or cat. Notice that it is the arm which places the hands and its fingers. That is how you need to approach the piano, with the arm placing the fingers. The fingers don't drag the arm behind it. The amount of flexion and extension that the forearm (some think fingers) actually does is only a fraction of playing. When you play from the arm, your fingers (extensors and flexors) can truly relax and protect the tendons caught between the bones and muscles.
If your teacher hasn't covered these things with you, maybe find a better teacher? The mechanics, ergonomics, biology and physics of playing the piano isn't hocus pocus or mere talent. It is real science. Ask any Olympic athlete.
I watched a show called TITANS (?) last night where two competitors had to turn a crank to lift a heavy weight. One used his shoulders and arms to brute force crank the weight. The other jumped on the crank and used his body weight to push it down and the momentum of his gravity to push it up, using equal and opposite motions. Guess which one won?
On Big Brother last week (I practice with the TV on) Olympic star Ryan competed against John (?) to swing from a ledge and knock down a wall of blocks with their body. Ryan immediately knew in order to reach the right, he had to jump to the left. John just jumped willy nilly and lost.
And on monster trucks . . .
Go pet a dog.