@Eambos- The principle of inertia would still apply. The planes would have to be flying at the same speed, and the lower plane would have to be structurally modified to support the added weight and drag coefficient after the top plane had docked, but it can be done.
Here’s a nice shuttle piggyback pic, with an extremely heavy shuttle riding on a 747. This is how they tansport the thing cross-country, and the Boeing stands up to repeated take-offs and landings with that massive thing on its back. An in-air, same-speed docking would (theoretically) put far less stress on the airframe.
Like I said, it can be done.
It would require some precision flying, as I alluded to before.
AND, as I also alluded to before, the rationale for performing the act would also come into question.
As you said, it would be extremely dangerous; but no more dangerous than coordinating a barrel-roll or loop in tight diamond formation, which our Thunderbird and Blue Angels pilots do on a daily basis.