A) returned to the capital after his long exile, he built a luxurious mansion and married the Emperor’s daughter, whom he had known as a child
seems fine.
B) had returned to the capital after his long exile, he built a luxurious mansion and married the Emperor’s daughter, whom he had known as a child
should be in simple past as there's no clear indicator when one event stopped and other started
C) had returned to the capital after his long exile, he built a luxurious mansion and married the Emperor’s daughter, who he had known as a child
same as B. who should be whom as "Emperor’s daughter" is the object of the sentence
D) returned to the capital after his long exile, he built a luxurious mansion and married the Emperor’s daughter, who he knew as a child
same as C,who should be whom. "knew" should be "had known" as the process started and continued for a period of time
E) returned to the capital after his long exile, he built a luxurious mansion and married the Emperor’s daughter, whom he knew to be a child
"knew to be a child" this changes the meaning in whole different way
IMO A