It was to parallel Ned.
Varys got Ned to break his honor for the good of the realm because it would protect Sansa and Arya.
Tyrion got Jon to break his honor for the good of the realm because it would protect Sansa and Arya.
Jon got the punishment Ned was supposed to get if Joffrey wasn’t an idiot