Here what matters in court is, have drugs been found. If the cops think someone looks suspicious enough, they can search him. And if drugs were found, than this is all that matters in court, because obviously the cops were right with their suspicion if something was found. I don't see how that evidence could be challenged in court?
(No one said, that the dog is a drug dog. People just assume it and the police uses that assumption)
That is entirely incorrect. German law follows a similar structure to the United States regarding the admissibility of evidence that was collected improperly. Evidence obtained in violation of the law, particularly by infringement of the privacy of the home or person, may be excluded from the trial if the violation is deemed to have a significant impact on the reliability of the evidence. The standard of probable cause in German law is known as "concrete indications of a specific criminal offense" (konkrete Anhaltspunkte für eine bestimmte Straftat). It requires officials to have concrete indications that a specific criminal offense has been committed or is about to be committed before they can conduct a search or seizure.
Still, in case of the dog: it would be interesting, if there was a case about it, as I am very sure of the practice in reality.
Police will do, what works and with what they can get away. Most people will just comply when the police tells them to open their pockets (note that they don't have to articulate it as an order, the same if police comes to your door without a warrant and they ask if they can come in) assuming the police has the right. (and drug addicts usually do not have a lawer).
I don't know if it would hold up in court as a justification for searching, that a person looked nervous because of a police dog as the person just could have fear of dogs in general, so they likely would avoid it.
(Also, if you happen to live within 30 km of a nation border like me, then police (Zoll) can search pockets and cars all the time without concrete indications. So they could use this tactic without problems, but I have never seen the Zoll doing it, but the normal police in the cities)