^Exactly. That's why I hate the cliche "Robots don't have feelings, all they have is programming!" Emotions are
programming. They're preset responses hardwired into our brains. We don't learn to feel or choose to feel, it happens automatically. An animal's emotions are pretty simple -- you're scared and you run, you're angry and you attack, you're horny and you mate. What makes human emotions complicated is their interaction with our thoughts, beliefs, and choices -- like the loyalties and commitments that make us choose to face danger when we're scared, or the cultural mores that keep us from sleeping with the wrong partner. So emotion is the easy part; intelligence is the really complicated part. It would be far easier to program a computer with emotion-like responses than it would be to make it sentient and capable of autonomous thought and choice. So the fictional conceit that emotion is some magic alchemy that's beyond the capacity of an intelligent machine is just silly.
Of course, it's not quite as bad in the case of Soong-type androids, since we've seen that models like Lore and Lal can
have emotion, but it goes wrong, either leading to cascade failure or resulting in a psychopathic personality. So Soong left emotion out of Data on purpose
as a stopgap, intending to restore it once he'd solved the problems, but never getting around to it because he had to flee the Crystalline Entity and abandon Data.