The 60's German SF-series "Raumpatrouille" (Space Patrol) had some sort of primitive robots who were programmed with a rule that "a robot may not in any circumstance do a human any harm" or something like that.
That didn't prevent some robots to actually seize power on a mining colony. When some of the human workers started to argue and kill each other, the robots became neurotic and took over the colony.
In some occasiions, The Doctor's program made him almost "too human".
Like in Real Life (hmm, why do I always write "Still Life" which is an Iron Maiden song?) in the situation you describe above. I would have told The Doctor the same as you did.
We also had that scenario in Heroes And Demons when The Doctor became so devastated over Freya's death that he refused to call himself Schweitzer anymore.
He could easily have replayed the Beowulf holoprogram in which Freya wouldn't have died, then he could have created a new oprogram in which he marries Freya and live happy with her all the time when he's not active in Sickbay.
What would be the point of him developing as a character if the writers had allowed the Doctor to do that?