If you break a fully grown pumpkin stem or melon stem that is attached to an adjacent pumpkin/melon, no seeds will drop.
This also applies to entities trampling the farmland, breaking the attached stem with a piston, water washing the attached stem away, and /setblock destroy.
is duplicated by
MC-151868Breaking soil underneath a fully grown pumpkin stem does not yield all of what the stem would drop if broken by hand.
MC-155153Breaking pumpkin/melon stems doesn't give seeds