I know that the social relationship between speaker, listener and referent are grammatically realized in japanese and korean. I know there are different levels for the relation between speaker and listener, and between speaker and referent. Yet I do not know if the relationship between listener and referent is expressed this way.
With regard to the modern Korean language, my answer would be "not quite but sometimes". Rather, speaker-listener and speaker-referent relationships are encoded separately and combined in the verbal inflection. However, listener-referent relationship might have an influence.
The standard situation to test this is when the speaker is of higher social rank, the listener of lower social rank, and the referent is of intermediate social rank (e.g. the 선생님 seonsaengnim speaking to a 후배 hubae about a 선배 seonbae, equivalent to musicallinguist's example).
In this case, depending on the closeness of the speaker-listener relationship, either polite informal 해요체 haeyo-che or a rather usual mixture of non-polite informal 해라체 haera-che (often called "plain style") and 해체 hae-che (often called "intimate style"), referred to as 반말 banmal, would be used.
The encoding of the speaker-referent relationship is generally done by the use of the -시- -si- verbal infix. In this case, as the 선배 seonbae is of lower status than the speaker, there is no use of this infix. Thus the listener-referent relationship, where the -시- infix would be used, is therefore lost. The resultant verbal form would be therefore indistinguishable from a case where the listener-referent relationship where the referent had lower social status, e.g. the 선생님 seonsaengnim speaking to a 후배 hubae about one of his/her 동생 dongsaeng (a younger sibling).
However, the reverse polarity may be influenced by the listener-referent relationship; the most common is dubbed 압존법 (Sino-Korean: 壓尊法) abjonbeob, literally "respect restriction". For example, if a person is talking to his grandfather about his father, the speaker-listener relationship would generally mean either the polite informal 해요체 haeyo-che and/or the polite formal deferential style 합쇼체 hapsyo-che. Whilst the speaker-referent relationship would usually require use of the -시- -si- infix, as the listener has higher social status than the referent, the listener-referent relationship traditionally overrules the speaker-listener one and the -시- -si- infix is omitted. It is also noted that this is dying out amongst "younger speakers". There is a related question on Korean Language StackExchange.
There are other phenomena, for example when parents talk to their own children in referring to relatives who would require honorifics from the children but not the parent ("stance shifting" in child-directed speech). The listener-referent relationship overrules the speaker-referent relationship and the parent uses the honorific infix.
Though my familiarity with Japanese is much lower, one could see the 内外 uchi-soto distinction as an example of how listener-referent relationships can affect the speech levels used. I'm led to believe that the effect of 内外 uchi-soto means listener-referent considerations are taken into account more often in Japanese than in Korean, and that this is reflected in a greater range and productivity of non-subject referent honorifics.
I'm not sure if I understand the question, but the following example from Genji expresses grammatically the relationship between listener/referent in the speaker's mind.
The referent (Genji) is socially higher than the listener, and this is explicit in the たてまつる .
It'd be easy to find similar examples in modern Jp.
In Japanese, I think for most relevant situations in which this question could be tested, the answer is no.
For example, I was on the judo team at a Japanese high school, and there were very clear status rankings among the coaches (sensei), senior team members (sempai), and junior team members (kouhai). If a kouhai were talking to or about a sempai, the kouhai would be expected to use a respectful register. But if a sensei were talking to a kouhai about one of that kouhai's sempai, the register would not be as respectful, so the sempai-kouhai (i.e., referent-listener) relationship would not be encoded.
I can't speak to how things work in Korean.