The people here were not working for the UN but for Russia, representing Russia at the UN.
The US can expel such people as if they were diplomats accredited to the US. This provision is found at Article III, section 13(b)(3) of the UN Headquarters Agreement:
Persons who are entitled to diplomatic privileges and immunities under
Section 15 or under the General Convention shall not be required to leave the
United States otherwise than in accordance with the customary procedure
applicable to diplomatic envoys accredited to the United States.
People who work for the UN are subject to the same section of the headquarters agreement (and, if I recall correctly, a different section of the general convention), but are less susceptible to being used for political pressure. A Russian director of a UN agency is not an attractive target for expulsion in a dispute with Russia, because that expulsion is detrimental more to the agency than to Russia. Furthermore, a UN officer's duties do not include representing Russia's foreign policy positions. By contrast, that is the primary duty of a Russian diplomat.