Yeah, Hogwarts accepted Snape as headmaster, because he was chosen by Dumbledore. I think the official appointments or pronunciations of the Ministry were pretty moot to the school; hence Umbridge's difficulties.
I'm not sure I'll necessarily credit the castle with being sentient enough to know who is a good person for the job or not; that leads to difficulties in choosing headmasters that I feel would have been mentioned at some point (probably by Hermione), if it were common for a headmaster to be chosen only to have the school rebel.
But I think Hogwarts was loyal to its headmaster-of-the-day, and I think that it could tell who was a legitimate successor and who wasn't. When Dumbledore fled the Ministry, he didn't really abandon Hogwarts -- he just left it for a bit. So Umbridge could call herself whatever she wanted to, but Hogwarts knew that Dumbledore was still in charge, and would be back. When Snape stepped in, it might have looked the same from the outside (a corrupt Ministry of Magic appoints a new headmaster to take the place of the departed Albus Dumbledore), but there was something very different going on behind the scenes. And that, I think, Hogwarts could recognize.
. . . .
On another, related note, I don't necessarily think that Snape would have made for a good headmaster. Did he do a good job of trying to keep the Carrows reigned in, and the students protected, and the school intact during Voldemort's year of terror? Yes, absolutely. Did he do a good job of finishing Dumbledore's missions, and seeing to it that the good guys had a chance to win the war? Certainly. But I don't think he necessarily had the temperament to be a good headmaster, long-term.
I don't think he would have been awful, no, but I don't think he would have been great. Snape was never detached enough, or fair enough, and quite frankly, he never really liked children all that much. He liked learning, and I think he made a very decent teacher (Harry's singular case aside), but he wasn't really equipped to be the person in charge of the entire school.
Maybe in a few decades, when he had more experience, and would presumably have mellowed a bit, he could have been; after all, we have to remember that Snape was still quite young when he died, really. He was probably one of the youngest headmasters Hogwarts ever had; I imagine they were mostly like Dumbledore: wise and at least a little bit elderly before they ever sat behind that desk. Like McGonagall, when she stepped in after the war. I think she probably made a very good headmistress, I do...and I don't think, had Snape survived, he would have made as good a one. In fact, I'm not sure he would have even kept the post; McGonagall probably would have taken it on, even if Snape had still been alive...and I'm not sure that Snape would have argued with her doing so. That's all pure speculation, granted, and entirely moot...
But what do you guys think about Headmaster Snape, from a potentially long-term standpoint, rather than simply the Man Holding Down Dumbledore's Fort (or Castle) under Voldemort's Ministry?