After I added the pull-up, I could see the bouncing clearly. Before there was nothing at all when I connected/disconnected the headphone, no matter how quickly or slowly I fiddled with the headphone connector.
Therefore I don't expect to see a difference with the added debouncing code.
I haven't tried the simplest thing yet: Unconnecting the audio plug coming from the Pi 3 and see if this makes a difference. I will try this, but it may take a while.
Since there is no software pull-up defined on the port: How is the high or low state defined? Isn't the port dangling if there is no headphone connected? Or is there maybe a hardware pull-down resistor in place?
In other posts I have seen that the audio-in and the headphone-out are electrically connected. Therefore I guess an electrical change on the Raspberry Pi could propagate to the headphone connector.