"Orders not to degrade your commander-in-chief" is exceedingly broad. It depends on the circumstance. But typically young recruits need simpler guidance, and that sounds like what that young soldier was given.
You are free to have an opinion of your commander in chief, and free to express it as long as you are not expressing it in a way that might be construed to be in an official capacity.
I'm thinking of the time some officers had a skit making fun of Nancy Pelosi at a semi-official function off base (not in uniform but a military function), and the video got out -- a couple of commanders were fired from their positions, though not court-martialed. Poor judgment. Article 15's too, probably.
If an active duty soldier, or a reservist before retirement, I also wouldn't write a guest column in a newspaper criticizing the president directly -- that would be problematic if you were identified as a military member.
There is such a thing as sedition but it's a very high threshold.
In the case you mentioned the young person you met was absolutely free to say to you what he wanted to say, and if there were any doubt he could always used the caveat "...but that's my personal opinion, not the official position."