Dams create large bodies of water that change ecosystems and provide focal points for human communities. They certainly do more than just hydroelectric.
An example would be Lake Pillsbury in Northern California which the dam has not done hydroelectric for decades but the fight to prevent demolishing the dam has had plenty of local support.
In addition to other answers, dams are sometimes used for mechanical power without generating electricity. More likely to be historic use than current use, but also likely to be a candidate for removal for fish habitat.
Right, it's like with literal wind mills (not wind turbines). In a very few cases it's part of a museum showing how mechanical power was used to mill flour, or power weaving machines, or whatever. Getting rid of literally every single one would be a mistake. But in the other cases they're just left to decay and so we should remove them and restore what was there before.