Eunuch traditions must've diverged at some point so that eunuchs were able to have bigger roles in the military.
From a quick search was there actually an army of them during the Ming Dynasty?
Beginning in 1508, Emperor Zhengde of Ming (r. 1505-1521) attempted to create a single battalion (which in Ming meant 1,120 men) of eunuch soldiers to protect the Inner Court. He never really did anything with them and they never saw any action, they mostly just made a lot of noise in drills in the courtyard, with Zhengde playing at being a field marshal. He did a lot of stuff like that; Emperor Zhengde was famous for doing things like building an entire fake city street and having the entire court play the role of common merchants and stuff to sell the illusion so that he could experience walking around like a commoner.
It wasn't until 1552, in the reign of Zhengde's successor Emperor Jiajing (1521-1567), that there were enough eunuch soldiers in the battalion to necessitate a proper barracks be built for them. Apparently this facility was either insufficient or had become dilapidated, because in 1567 Jiajing's successor, Emperor Longqing (r. 1567-1572) wanted to have it refurbished, but the idea was dropped after one of his grand secretaries opposed it. Longqing more or less left the eunuch battalion to languish after that.
Emperor Wanli (r. 1572-1620), however, was of a very different mind. Only 9 at the start of his reign, as he grew older he gathered two new battalions of eunuch soldiers (more than 2,000 men) and resumed training on the palace grounds at least as early as 1583, when the 17 year old emperor asked the Minister of War to deliver 3,000 warhorses for use by his eunuch battalions. The minister, Zhang Xueyuan, refused, and argued long and loud that the emperor should disband the eunuch battalions, citing an incident earlier that year when they had accompanied the emperor on an official tour of imperial mausoleums, in which he claimed the eunuchs had acted in a manner that was "egregious and contrary to all military norms." For his troubles, Wanli "asked" the minister to retire, and then added another battalion of eunuch soldiers for a total of 4, and handed out 20,000 taels (1 tael = roughly 40 gram) of silver to them for purposes of morale.
In 1584, rumors started spreading that Wanli was not only tolerating the bad behavior of his eunuch soldiers but encouraging it, and another minister, Dong Ji, filed new charges against the eunuchs, claiming that the power invested in them was outraging the populace and the army. His reward for speaking out was being demoted two degrees and reassigned to the frontier.
Eventually, though, one of the grand secretaries, Shen Shixing, joined those speaking out against the eunuch battalions and did so in ways that Emperor Wanli wouldn't construe as a personal attack: he argued that the noisy drill and the coming and going of so many soldiers presented a security risk that hostile agents could use to sneak into the Imperial City. Wanli didn't disband the eunuch soldiers entirely, but he did cut back on the number of drills and didn't force Shen to retire or anything.
However, the succeeding Emperor Taichang suddenly died in a mysterious and controversial affair after barely a month as emperor. In the resulting confusion, the eunuch Wei Zhongxian took control of the court and the 15 year old Emperor Tianqi (r. 1620-1627). At Wei Zhongxian's "advice," the project of eunuch soldiers was not only resumed but their number was increased to two whole guards (1 guard = 5 battalions = 5,600 men), and despite many complaints and remonstrants from court officials, this remained the status quo until the fall of the capital in 1644.
The purpose of the eunuch battalions, though never stated outright, was clearly, at least from Wanli's reign onward, so that the Ming emperor would not have to rely entirely on the apparatus of the army and the court officials for his personal protection. It was a way to guard against the sedition and conspiracy so common in the waning days of Ming, in much the same way the later emperors of Han invested political power in the eunuchs to check the imperial in-laws and the court bureaucracy that so often backed them over the emperor.
But that necessity didn't quite exist yet in Han, due to the way Han's military was structured.