Yeah I got pulled over once and illegally searched by dogs. They supposedly alerted. It totally wasn't that half a Subway sandwich on my passenger seat. They proceeded to tear my car apart anyway while simultaneously trying to convince me to confess to drugs that weren't in my car. Scumbags.
Humans are just bad at training the right behaviours. We know what the goal is, so we assume that it's in some way obvious to the dog as well.
Having said that, I also don't want to be on a flight with some weirdo who has bought pizza with them so the dog is still performing a valuable service.
They don't know they're getting someone in trouble, they just know that if they act a certain way when they smell something, they get a treat.
That's why this tweet is horrifying, because they're training the dog to do that when they smell pizza, which means that you get to be searched because you smell vaguely of pizza.
Also cats can be trained to do the same thing. They just like dogs more because they're easier to find/notice if they wander off a little bit, and can bite people.
This is probably a situation where their handlers and trainers ate or were around pizza or something while training them... not sure if that's funny or scary