ST Voyager "Flesh and Blood":
EMH: You've given me extraordinary freedom over the years. I've obviously abused it.
JANEWAY: Maybe. Or maybe you've simply become as fallible as those of us who are made of flesh and blood. I'm just as responsible for allowing you to expand your programming as I am for giving technology to the Hirogen. How can I punish you for being who you are?
EMH: I don't know what to say.
JANEWAY: I'd like a complete report on your away mission.
EMH: You'll have it.
So the doctor disobeys a direct order by not reporting to the mess hall and goes to sickbay instead. He then commits subterfuge by downloading the strategy that's going to be used by Voyager and coming up with a defense against it. He then gives Voyagers shield frequencies to an enemy ship in the middle of a battle. He transports to that other ship and gives them the info needed to create an overload in Voyagers deflector dish, which completely disables Voyager and leaves it adrift in space. As a result Torres is kidnapped.
Tom Paris is put in the brig for 30 days without visitation, and is demoted to ensign for doing what he thought was right by trying to save an entire ocean. In the process he tried (albeit unsuccessfully) to destroy a mining operation.
I can give many examples when the captain was disappointed or gave marks on peoples records. For example Ensign Kim got a mark on his record by falling in love and disobeying an order to see the alien girl he fell in love with. He took her out one time in a shuttlecraft and made some phone calls. This hardly rises to the level of what the doctor did here.
Janeway says, "How can I punish you for being who you are?" We do this all the time in societies, if who you are is violating the rules/laws and putting people in danger.
Janeway decides instead to change the status of the doctors actions to an "away mission?!?"
Can somebody explain to me why the doctor wasn't punished here and Janeway would give this comment about "who you are?"
In universe canon, or writers notes/out of universe answers are welcome.