Yeah, I don't think working on the Tor project is the reason. Tor was originally created by the US government.
Whatever the reasons, I don't think it's justifiable to stop, question and search someone repeatedly like this without suspicion of a crime. If he's guilty of something, he should be charged, if not they shouldn't be using border agents for fishing expeditions and confiscating laptops/phones etc.
He really should familiarize himself with The Moscow Rules.
I don't see why you'd jump to that conclusion at all.
(Note that I have no opinion about this specific situation)