Despite this being a pretty well-known thing, nothing relevant appeared upon searching, so hopefully this isn't a duplicate.
Fence gates, pumpkins and jack o lanterns (but not melons) require certain blocks underneath them to be placed, but will remain if said block is removed. This bug was fixed on the Java edition fairly recently (
MC-1947), so it makes sense this should follow suit.
Interestingly, the blocks considered acceptable vary between the block; fence gates can be placed on leaves, whereas pumpkins and jack o lanterns cannot.