While it is true that CBPOs are given absurdly wide latitude to violate the rights of the people who request entry, there is a limit I think. They cannot refuse entry for a US citizen with valid ID. Period. Even one who doesn't consent to any searches. And they cannot literally force you to have your genitals/crotch searched. As in physically. At least not without probably cause or at least reasonable suspicion that a crime has been or will be committed. Which means more than a vague hunch. IANAL though.
But if CBPOs are allowed to do whatever they please to your body as soon as you present yourself at the border even if you withdraw your request for entry then it is a gross constitutional and human rights violation and whatever federal law allows it should be annulled. I would physically resist such a rapesearch with whatever improvised weapons I had on hand. No government has the absolute right to engage in forced sexual contact with another human being.
If a CBPO wants to get his jollies by jerking off a dog or pig or something I wouldn't have a major problem with that. After all, we routinely kill them. But as human beings we should be treating each other with more respect than that. Any government that treats people like that is a pathetic, out of control, police state. Full stop. Luckily, AFAIK, the only government in the world currently that would even be tempted by the idea is the US. Probably the most fascist-leaning government on the planet.