I think exceptionally using 「を」 with normally 「が」-marked words is not something unique to 「好き」 and 「嫌い」.
Let me start by expanding the scope of your question: the other questions you linked to explain why 「が」 can turn into 「を」 under 「〜と[certain verbs]」; they did not explain why things like 「私は太郎が猫を嫌いな理由は未だに分からない。」 are just fine.
So I think why 「が」 can sometimes turn into 「を」 in relative clauses is important to discuss as well.
Relative clause weirdness
Consider the following examples:
×太郎は英語をわかる。 ⇒ 太郎が英語をわかるはずがない。
×太郎は英語をよくできる。 ⇒ 太郎が英語をよくできるはずがない。
×太郎は猫を欲しい。 ⇒ 太郎が猫を欲しい理由は分からない。
While を is not permissible in the first sentences, it is in the latter. The difference in the latter of course being that the verb and its argument is in a relative clause.
It turns out that, of all of the cases where I can think of that this happens, the が that we would normally see (太郎は英語がわかる) is the so called "nominative object marker".
A nominative object is to be distinguished from a usual subject-subject construction:
We can distinguish these cases by a few tricks.
In the first case, the subject honorification ends up connecting to シラミ, which doesn't make sense (cf., 山田先生は美しい奥さんがおいでになる).
In the second case, 猫 is a (nominative) object, so subject honorification doesn't connect to it.
In the first case, 自分 binds to 恋人. Some native speakers find it ambiguous and think it can also bind to 太郎.
In the latter case, 自分 must bind to 太郎, because 花子 is an object.
To learn more about nominative objects, read
Miyagawa, S., & Saito, M. (2008) Nominative Object. In The Oxford Handbook of Japanese Linguistics.
Kuno, S., & Johnson, Y. (2005) On the non-canonical double nominative construction in Japanese.
(The latter is an absolutely fantastic paper but I can't seem to find a un-paywalled copy of it online.)
Nominative objects in relative clauses
My claim is that when you have one of these verbs that mark their object with が in a relative clause, it sometimes becomes permissible to mark them with を. I can't seem to find any relevant papers.
I think this is not always the case -- for example...
I think the latter sentence may not work. There are other cases where I'm not entirely sure, but I am unfortunately not a native speaker.
Here's a list from Kuno 1973 of predicates that accept nominative objects:
- Competence: 上手、苦手、下手、得意、上手い、できる
- Feeling: 好き、嫌い、欲しい、怖い
- Nonintentional perception: 分かる、聞こえる、見える
- Possession and need: ある (have)、要る
If any native speakers could try embedding these in relative clauses and seeing which ones do and don't allow for を, perhaps we could come up with an even more refined argument.
But at least, in all cases where を does work in a relative clause yet doesn't outside of a relative clause, as far as I can tell it's always a nominative object outside of the relative clause.
In other words, while this is not true:
is nominative object → can be marked by 「を」 when in relative clause
I think this is true:
can be marked by 「を」 when in relative clause → is nominative object
With question sentences, it seems that verbs that can use 「を」 are the same as the ones that can in relative clauses.
Taking できる, for example,