It is unnecessarily harsh, but the behavior is also important if the answer contains a letter once but your guess contains it twice, not only if the answer contains it twice.
That's not very CIVIC. I'll pay you a VISIT. After calling my MUMMY. SORRY, just trying to be FUNNY.
MOMMY, he TOOTS and is SILLY. Better than having the SHITS, I GUESS.
Ironically, today's answer had the same letter twice.
Spoilers!!
First half a dozen or so times I did it I just assumed you couldn't have a duplicate letter.
The problem also happens if the answer contains the letter once, but the guess contains it twice. Imagine the middle letter in the answer is an E, no other E anywhere. I guess EXXXE (assuming that's a word). Both E are yellow: that's incorrect. There's 1 misplaced E and one superfluous E. Which is which is arbitrary. In the version of the game I made from my discord bot, I go left to right, so the E on the left would be yellow, the one on the right would be grey.