The real reason is because the prequels were not thought out well enough before the original Star Wars.
However, there a much more interesting reason that is cannon, and was brought up in the original Star Wars, now A New Hope, in most of the subsequent films, and is explicitly mentioned in Solo.
That Droids are slaves.
They are property, even though they give all outward appearances of being sentient and having feelings. They are brave, make sacrifices, and are to all appearances loyal.
They are discriminated against: “We don’t serve their kind in here.”
They are bought, sold, and held in chattels: “The restraining bolt has short circuited his play back mechanism, he suggests if you remove he may be able be playback the entire message.”
Our heroes, and our villains, all think of all droids in this manner.
They are treated worse than second class citizens. They are not friends. I would argue that they are treated worse than pets.
It is any wonder that Anakin, Obi-Wan, and Owen Lars don’t remember individual droids?
We treat them as comic relief and as interestesting characters, in universe, they are appliances.
(Originally posted on Quora in answer to: Why didn’t anyone like Obi Wan, the Lars family, or Darth Vader recognize C-3PO or R2-D2? )