I think they are meant for people to believe they do something so they'll feel better and wait. I used to walk a lot and encounter lots of crosswalk with buttons and I got used to how fast I should go in order to catch green every time and I could predict when the next crosswalk was going to turn green. If they truly worked then they should have been out of sync. I never pushed the buttons and I saw the light turning green even though no one pushed the button, if the buttons worked then why would the light turn green?
I also asked gemini about this and he said I'm not going insane, strange because I never mentioned if I was insane or not, but good to know I'm not.
Maybe some buttons work and other don't depending on where it is?
If it's a busy intersection, chances are you're only allowed to cross when the cars get switched to go in parallel to you.
If it's a normal street, but still with a high volume of pedestrians, then there's likely a sensor to detect waiting pedestrians. Also depends on how new the traffic light installation is and how much the municipality spends on this.
I think, the sensor also allows detecting the number of pedestrians waiting, so they can speed it up.
If it's a street where pedestrians only cross sporadically or an old installation, then the button is likely to work and that you have to press it to ever be allowed to cross. Running a sensor all day just isn't worth it.
Obviously, the specifics depend on the region, but I feel like these are rules of thumb that make sense pretty much everywhere...