Think of how B perceives it:
B: ... think think think think think think think—Sorry, what did you say?
A: [blah blah]
B looks back and thinks of A's utterance as an event which is completely done, finished. Linguists call this view of an event the perfective aspect. Perfective aspect in the past is expressed using the past form of a verb, You said or You did say.
That event, A’s utterance, occurred at a time when B was in a state of thought which started before A's utterance and ended sometime after it. Linguists call this view of a state imperfective aspect. Imperfective aspect is expressed using a progressive construction; in this case, since the state lies in the past, B uses the past progressive construction I was thinking.
Perfect constructions like I have thought and I have been thinking express a state which arises from a previous event and is current at the point in time which you are talking about. Linguists call that time you are talking about reference time (RT). A present perfect construction has the present as its RT: it expresses a state which is current now, at the time of speaking. Since B is talking about a past event, his† RT is the past; in that context a present perfect cannot be used.
A past perfect construction expresses a state with a past RT, a state which was current in the past, so you might think that I had thought or I had been thinking would be appropriate here. But the perfect construction does not express a state denoted by the lexical verb (think) in the construction, it expresses a state which arises from the state or event denoted by the lexical verb. B is not talking about the result of his thinking, he is talking about the thinking itself—so a past perfect construction doesn’t work either.
There is more about aspect here, and entirely too much about perfect constructions here. Be careful not to confuse perfective aspect with perfect constructions—they are entirely different things.
† I make the appallingly sexist assumption that A is B’s wife, only because that’s how this conversation always plays out in my own household.