It's worth mentioning that security agents have been busted stealing cash and valuables from passengers at airports and ports.
You make it sound like this is a common thing... At least in Western countries it is NOT. Frankly I am unaware of
any incidents of it happening in the US CBP. Mainly because all inspections are done according to strict protocols one of which is the mandatory presence of at least 1 other officer.
Stealing cash and valuables from travelers has always been more of an issue centered around the baggage handlers and even then in the US it is an exceedingly rare occurrence.