This is the nature of democracy, and any way of stopping this from happening would be a case of the cure being worse than the disease. This same process is how women's suffrage, civil rights, gay rights, medical marijuana and many many many other smaller victories for rights have been enabled over the years. Each one of those was brought up by politicians and lobbyists time and time again, defeated time and time again, until one day it wasn't and it stuck.
Personally I think that smaller, decentralized, local government is the best way to minimize the harm of this nature, but I fully recognize that it also means every group must fight the same fight multiple times in multiple places in order to secure their rights all over, and that's its own harm.
But I can't think of any way that you could "permanently" defeat "bad" bills that wouldn't equally have harmed those other movements.