I think that Hamlet is harsh with both of these women, and while I understand the road to hell is paved with good intentions, Hamlet does think he has good intentions. With Ophelia in the "get thee to a nunnery scene," Hamlet has some very harsh words about his feelings, or lack thereof, for her, but his intent is to a) act like a crazy man, and b) try to warn Ophelia away from men because Hamlet has a fairly low opinion of men, calling them "errant knaves all." Perhaps he truly thinks Ophelia would be better off in a nunnery away from male companionship. No matter what his intentions though, Hamlet deeply hurts Ophelia and this shakes her emotional stability.
With Gertrude, Hamlet is incredibly condescending to her in the "closet scene" when he dares to suggest how she should not have any passion left in her "for at your age the blood does cool." It is also kind of insufferable that he is going to teach her how to stay away from Claudius and how each night will go a little easier. What does he know of it? Hamlet's intention is just get his mother to see the error of her judgement in marrying Claudius, but his tone was rude.
I feel sorry for Ophelia and Gertrude. Ophelia is completely an innocent in the play, and Gertrude, while not completely innocent, is not treated with motherly respect. Neither of them deserve to die in the manner they do. However, without all the deaths, Hamlet would not be considered a tragedy. :)