There's only a contradiction if you insist on a formalized timing. There is no formalized timing in 5e, just the statements that reactions occur after their triggers unless they say otherwise. Since Uncanny Dodge does not say otherwise, it occurs after the hit is completed. Since shocking grasp prevents reactions on a hit, you cannot react to that hit (except with shield, which specifically says it interrupts it's own trigger and can negate it). There, no timing charts and everything works just fine. It's only when you apply a strict order of events that's absent in the rules that you end up with your contradictions.
That's not quite true. We have a Jeremy Crawford answer that uncanny dodge can be applied to a hit which would have knocked the rogue unconscious. Since unconscious creatures can't use reactions, you can use the reaction before the hit's effects are applied.