The ecological impact of dams is totally local, but the ecological impact of CO2 is global. If we were to power the entire earth with hydro, the local damage to ecosystems would be a very small price to pay indeed.
A lot of the impact can be mitigated by building fish pass channels, building new habitat such as compensation channels, and controlling the rate of change of water levels.