Chaotic intelligence makes it impossible to remove parts of it
Welcome to the Sirius Cybernetics Corporation Complaints Division, the only part of the corporation to show a consistent profit in recent years.
- For complaints regarding our new GPP line of robots, please press 1.
- If your lift has taken to sulking in the basement, press 2.
- If your Artificial Intelligence has become emotional and started flirting with your space ship crew, press 3.
- For all other issues, that are clearly none of our area of responsibilities, kindly go stick your head in a pig.
First I would like to make a side-note to adress a couple of weaknesses with your question. You say:
Usually...
Well we are not talking about "usually". We are talking about your specific world. If you are going to model your world nothing but common tropes — that is to say employ only elements that are usually found in fiction — then what do you have except a very generic world?
a relationship between an A.I. and a human is taboo
You need to ask: Why? Why is it taboo? Why — in your specific world — is it taboo for a romantic relationship between a human and an A.I? If you say "Well it just is because I need that trope for my story", you are crowbarring the trope into the narrative just to set it up. And chances are that readers will notice that very conspicuous crowbar laying around.
You need to work out the cultural background as to why it is taboo in order to make this fly.
End side-note; now over to the actual question...
[the] A.I. comes with a romance sub-routine, [why]?
What do you mean "comes with a sub-routine"? Sure Star Trek: The Next Generation and Voyager discussed in those terms, but to be frank: if someone says "sub-routines", it instantly makes me think of programming BASIC in the 1980's. With AI's we are talking about hyper-advanced computers that are as far away from an 80's antique as we can get!

This is not the AI you are looking for (Note the white text on the 'H' key)
Unlock yourself from the shackles that is the idea that an intelligence — be it biological or artificial — consists of LEGO blocks that can be added and removed at will. Forget the notion of "sub-routines".
One of the great things that makes human intelligence so wonderful, and so extremely hard to disseminate, is that all our psychological traits interconnect and associate wildly. Our human intelligence has a strong element of chaos in it, that is to say it is not deterministic, and therefore it is also not predictable. One of the major reasons today that we do not have artificial intelligence is that our computers and our software are deterministic and thereby predictable.
So what you can do is to postulate the following: what we need — in order to make an Artificial Intelligence that is anything like our human intelligence — is something that uses associations and has a strong element of chaos in order to actually work.
With an element of chaos, and a method of operation that rely on associations rather than calculations, comes the inability to just rip out certain elements without breaking the whole unit. You can postulate that AIs are not programmed or manufactured; instead they are evolved and matured. Sure, they can be copied and duplicated — because they reside in artificial units that are produced to exact specifications — but the creation process simply does not allow the concept of "sub-routines" that can be ripped out at random, because everything fits together.
Hence, once an AI starts exhibiting emotions, you cannot just go in and say "Oh, just delete that part", because that breaks the AI. Sure, you can try to keep evolving the AI and breed away emotions by employing selection in such a way that only samples that exhibit less and less of the emotion propagate into new iterations of the AI. But you can never know for sure if the emotions are actually gone, because there is no map of the mind of the AI that says "here be romance".
Hence, this particular ship ended up with an A.I. that does have the capacity for romance in it. It was just very well hidden and no-one could foresee it. That will be an interesting warranty issue. :-D
See this meta post with regards to my small edit.
– JDługosz – 2017-12-02T09:32:52.6401This feels like idea generation to me. – sphennings – 2017-12-02T19:15:20.333
1I know it might just sound like semantics why rather than "why might a spaceship AI come with a romance sub-routine" perhaps "What are the advantages of installing a romance sub-routine on a spaceship AI" would give it a more objective feel and make it less opinion based/just ideas generation. – Lio Elbammalf – 2017-12-03T15:36:10.513
The feature is an easter egg. – JDługosz – 2017-12-03T19:15:07.760