>There's a chance that doing so might increase the likelihood of harassment again in future
I'm probably already at max likelihood already. I am detained 4+ hours everytime I enter the country. In 2015 I fought alongside the Kurdish militia YPG in northern Syria against ISIS, and ever since the CBP has targeted me. There is a flag on my passport that basically says 'harass him' as best as I can tell.
>if you can, find the relevant anti-corruption agency and report the events to them.
Still in the process of filing the complaints against the relevant medical professionals who violated patient consent. I am currently working in order of operations from where I expect justice to be most likely (complicit medical workers) to where I expect justice to be impossible (CBP officers).
Sounds like you've got a good, considered approach, so keep up the work to improve the environment and keep in mind other ways you can develop (and enjoy) your time is probably the best platitude I can offer (and one you probably already understand).
Criminal 'justice' in US is in dire need of overhaul, and an actual plan on how to get our imprisonment rate down to other first world nations.
It's understandable (and not necessarily wrong) to vent here, and I'm not going to ask whether you have done this already, because it's not useful to draw out an answer, but: if you can, find the relevant anti-corruption agency and report the events to them.
There's a chance that doing so might increase the likelihood of harassment again in future -- I have no idea how these things show up on border entry systems -- so it's your choice, but the key idea is to get a paper trail in place that will show up if (and hopefully when) investigations are later taking place.
I haven't worked in law enforcement, but I imagine that the same way that good policework involves collecting statements and records of events to put together a case, internal (or independent) investigations into misconduct require similar records. The ability for individuals to get away with bad conduct is, I'd guess, based on people believing that it's not worthwhile to file reports against them. They do get caught when they are.