NPC’s are needed so Player Characters have other people to talk to. Also fight. Also save. Also steal from. Also… well, just about everything else.
Even the best roleplaying game isn’t any good without them.
And yet, even the best programmed NPC’s can be a little bit weird.