While you wait on an answer, you may be interested in these posts by u/caffarelli:
Did the bizarre practice of turning men into eunuchs (and then giving these men substantial responsibilities) emerge independently in many places, or do we have some evidence of it starting in one place and then spreading through cultural diffusion?
Did the practice of using Eunuchs in state functions evolve from one state or did it begin independently in different places?