...now, because of Bernoulli principle, the flow of air sliding on the upper surface of the wing will accelerate, sometimes past the speed of sound in the air, generating a shockwave...
First look at the following answer https://physics.stackexchange.com/a/618694/59023 and those for the question What really allows airplanes to fly?. Yes, Bernoulli's principle does hold, but the more important reason for the phenomena you describe is known as the Kutta–Joukowski theorem.
BUT creating a model in which the wing is stationary and the wind coming, say, from left to right, means also that in the real world we have to invert all the velocities in the model, and in this case, in no point will the air go supersonic, but rather it will be dragged for a bit by the trailing edge before slowing down over the wing.
I do not follow this at all. The transformation is a simple Galilean transformation, i.e., the Mach number will not change because there is only one frame of reference in which it is physically meaningful. That frame is the frame of the piston/driver. Here that would be the airfoil rest frame. Sure, you can calculate the Mach number in different reference frames but the value is always defined with respect to the piston/driver so you will just have some additional work in subtracting velocities to get the proper normally incident flow (e.g., see answer here about aberration https://physics.stackexchange.com/a/669965/59023).
The closest example I can think of is pushing a hand on the surface of the sea: the water in front of the hand gets accelerated at the same speed of the hand, goes over it, slows down, goes back to stationary. In no point goes the water FASTER than the hand, and surely not in the direction opposite to the direction of the hand.
This isn't really a great comparison since the speed of sound in water is over four times larger than that of air.
During the initiation of a shock wave, a sound wave will undergo nonlinear wave steepening (i.e., larger amplitudes have larger phase speeds than the lower amplitudes, thus can "out run" the lower amplitudes). If there is sufficient energy dissipation, the nonlinearly steepening wave can reach a stable balance and form a discontinuity called a shock wave. During that initiation, the sheath region just behind the nonlinearly steepening wave can move relative to the piston/driver, i.e., it can move faster than your metaphorical hand for a brief period of time.
Once formed, however, I agree that a shock should phase stand in the frame of the piston/driver for a uniform, homogeneous inflow.
Are these considerations correct?
Not sure to which considerations you are referring but see my above comments.
If so, how do shockwave actually form?
See my comments above and the following answers for further details: