To reproduce:
1. Create a world in 1.12.2
2. Grow a melon and a pumpkin, but do not harvest them
3. Update to 17w50a and open the world
4. Observe the stems not be connected
Note that once MC-123143 is fixed, stems connected to 1.12.2 pumpkins should still connect to 17w50a sheared pumpkins because the connection between (sheared) pumpkin and stem won't have been broken logically at any point. (see MC-123144)
Impossible to do, the stems work fine but the direction is not stored in 1.12.2 and cannot be flawlessly inferred.