HFTs are definitely what I was thinking about. I remember reading about "quants", brilliant engineers working for investment banks to optimise their HFT algorithms, because that pays more than using their skills to invent or build things that are actually useful to society.
But the same is true for many other professions. I also remember reading that the highest paid engineers are working for Google and Facebook to optimise ad placement. CEOs get paid a lot even if their company does things that harm society. There's an entire industry just to help large companies avoid paying tax.