The button was pressing itself without touching it erratically
Thanks to the good instructions on iFixit the repair went smooth and easy.
The button seems to be the weak part of the iPhone 4. I had to replace it after 2 years of use. It had a very similar issue: one was that it “pressed” itself all the time, the other was that it was unable to press it.
Also the advise on step 30 is very important. But it has a typo in it: It says: “If the digitizer cable has not been installed incorrectly” instead of “If the digitizer cable has been installed incorrectly” (without the “not”).
Also, often it is easier to use your fingernails than the plastic instrument (iFixit’s spudger, which broke very soon apart, by the way).
Also, in step 24 it would be better to advice not to loosen the screws completely rather than to just say that it’s possible to do so. If removed completely it is much harder to put the screws back. I found it very easy to reassemble when the screws were just loosened.