They built it because someone in Product or AdTech dreamt it up, sold it to some VP or directory, and got some project + product managers to run with it. That's like blaming irresponsible mining practices on the miners and not the people who are actually deciding to mine in the first place, or even where exactly to mine. Even in those cases, if you try to take some ethical high-road that doesn't maximize profits or serve some VP's ego, you'll likely find yourself relieved of your responsibilities in short order.
Chain of command, but also investor pressure to do everything even remotely legal to maximize profits is more to blame. If devs push back, they get replaced with devs who don't. The money is too lucrative and there are too many qualified people to really have much power to "do the right thing" in most big corps. Sure, you can voice concerns and try to change things, but if the decision is between "do a thing users will hate but will make the company 2% more per year" vs "don't do this thing and hope people will like us more for it"...yeah, they're gonna find someone to get it done.