Genetics aren't that far yet.
Currently genetics is mostly understood as chemistry. You can, for example, use genetic modifications to make an organism capable of synthesizing a specific enzyme to metabolize a specific protein.
But how genes affect the structure of the brain and how brain structures affect behavior patterns is still a big unknown. The fiasco with the very aggressive africanised honey bees (a traditional crossbreed and not genetically engineered) hints that genetics do affect aggressiveness, but we are still far away from isolating the responsible genes and understanding how they interact. Making a genetic modification which results in a behavior modification as specific as "eat everything except two-legged, upright-walking beings with a height between 1 and 2 meters" is science fiction.
However, there is one theory that tyrannosaurus rex was in fact not a predator but a scavenger. This is considered a fringe theory among paleontologists, but without any live t-rexes around to study, the final judgment on this is still out. If this theory turns out true after all, they might in fact not be as dangerous as they look.
Also, keep in mind the "nature vs. nurture" debate. If t-rexes were trained from an early age that humans aren't food, they might refrain from hunting them. How easily trainable t-rexes would be is completely hypothetical.
And then there is a another thing: Humans might just taste bad. Remember that t-rexes are from an age where humans didn't exist yet. Their olfactory senses are tuned for recognizing prey animals from their time as tasty. A t-rex might attack a human once and then spit it out in disgust to never look at a human again. Bad for that one human who is now likely dead or has at least life-threatening injuries, but good for all other humans the t-rex will meet. The same thing applies to sharks, by the way. With most shark attacks, the shark bites the human once and then leaves. The theory is that it mistakes the human for a sea animal and leaves as soon as it notices its mistake.
The last point is in fact one where genetics might help. You could modify their olfactory senses to be hyper-sensitive to some molecule which occurs in the body odor of humans but not in that of more desirable prey animals. So humans would just smell disgusting for the t-rex. But this is quite a gamble, because you might also accidentally get the opposite result and enable the t-rex to track humans in a far wider range by their smell. Good luck!