[Spoilers Main] Ned didn't have to hide Jon from Robert.
Ned hid Jon's true parentage because he was scared that Robert might kill him. But why would Ned be scared of that in the first place? He was still Lord Paramount of the North. Yes, the North would be depleted from the war but so was everyone else at the time.
If Robert tried to call for Ned's head if he defends Jon, what's stopping him from just calling his banners? The riverlands would side with him because of Cat.
Jon Arryn could be a toss up. He might prefer Ned's level head or he could side with the New King. But he seemed like a morally upright person who probably wouldn't agree to the murder of a child. And Robert's rule was still not as solid at that time so he'd probably be less pressured to defend the King's rule.
At this point, Robert would still be regarded as a recent usurper so the Tyrells and Martells might even have sided with Ned for retribution, as ironic as it sounds. Not to mention Ned having the true heir to the Iron Throne.
Ned could have become regent to Jon, grooming him into a moral and upstanding King.
In the main series, Ned even had the balls to go against Robert when he initially refused to be Hand of the King or when he refused to have Daenerys assassinated. So he always had a strong sense of right in spite of authority.
I feel like the only reason he didn't was because of war fatigue. He probably didn't want anymore drama. Which is an incredibly valid reason at the time. But imagine what could have been.