Assuming the cop didn't just make that whole trespassing shit up...or that the trespassing in question was six months ago.
That's quite an assumption. Sure it's possible, but I'm inclined to give the cop the benefit of the doubt here. If he was making up shit, I'd have expected that to be reported. And why would he ask for backup? He'd then have to hope his colleagues didn't have a problem with him lying in order to question a random guy.

The cop has to see the guy doing something wrong to detain him afaik.
Something wrong? So a cop can only approach an individual if he catches him red handed breaking the law? A cop can't use his discretion to decide if he considers the guy suspicious? I don't like overpolicing at all, but asking someone what they're doing when they're present at a location that he has been sent to, that's reasonable.

He can't just go up to people and say "hey there was a crime around here some time. Are you a criminal?
Some time? I'm assuming the last half an hour at most. In which case, yes he can go up to people and ask what they're doing. That's his job, it's why he was sent there to investigate.

He can ask questions but the guy is not obligated to answer them. He can't then keep asking questions and giving orders like he did.
Agreed, but herein lies the problem. If you refuse to cooperate with a cop when he asks what you're doing, chances are it will perk his suspicion, warranting further questioning. And so the situation can deteriorate into a standoff quickly.

You're sure giving the cop a lot of benefit of the doubt.
There's no reason not to.

Just as likely (not more likely, but just as) he's the type to do his own racial profiling and use it as an excuse to wave his dick around.
This is the polar opposite of giving him the benefit of the doubt, and is no better than racial profiling. Why would you default to "cop is an asshole" when he's simply asking normal cop questions? Why is that any better than defaulting to "criminal" when you see a black person? Is it ok to discriminate against white cops? Is that what you're saying?

p.s. No cop ever admitted to me he was stopping me just to be a dick.
I've been pulled before for no apparent reason. It happens. Maybe it happens more to minorities, and that is a problem, but a bigger problem would be police feeling like they can't do their job out of fear of being labelled racist.

btw, the cop says at the beginning "I saw you sitting on the patio behind the building and I also saw a no trespassing sign. So I just wanted to make sure you belong here."

So he wasn't called there to investigate a crime, and he had no reason to think the guy was trespassing. Fucking Inspector Clouseau.
This does put a different context on to it, but it doesn't confirm that he wasn't called out. He does say "we've had some stuff going on here". Whether that's true or not is open to debate, but if it is, then the cop is well within his rights to question this guy.