Maybe VOY Doc wasn't the only one that became sentient, so it is possible that Starfleet had a real problem to deal with. If, perhaps due to a programming error, the EMH1 could become sentient, then maybe any EMH1 could, so any EMH1 that had ever been activated was therefore considered legally 'alive' so to simply deactivate and delete would be akin to murder. Therefore, what could be done with them, since unlike Doc, there were no other mobile emitters, so they had to be kept in an environment equipped with holoemitters. Also, given the personality issues with them, they couldnt necessarily be trusted to become as agreeable as VOY Doc, so to farm them off to remote colonies and research stations probably as not a good idea.
Slavery is wrong, but given the limitations of what could be done with them, maybe there wasn't much else that could be done. I would assume that because the EMH1's were reasonably aware of the state of the Federation at that point in time, the 'bottle environment' as given to Moriarty would not work as it would need to be too complex. (I wuld not be surprised if Morarty's environment was set to pursuade him to get to 'Earth' and settle down with his GF and retire to a country house somewhere, as this would reduce data loading, but of course, Moriarty would be none the wiser.
Given the reaction of the EMH2 to Doctor's 'additions' to his program, and keenness to experience more than just being a doctor, it looks likely that the same sentience error was made with the EMH2 as well.
Maybe they had to make an EMH3 with some kind of safeguard to prevent sentience emerging, to make sure that the problem of retirement of surplus sentient holo-people was not repeated.