Unfortunately, no by RAW.
As you've quoted, the spell requires (my emphasis):
a pile of bones or a corpse of a Medium or Small humanoid within range.
Once a dead humanoid is turned into a skeleton or zombie, they are no longer humanoids, but undead. Their form may be that of a humanoid, but their creature type is not. When creature types are mentioned, such as in this spell, that is the requirement.
A pile of bones that was previously an undead is now a corpse of an undead zombie or skeleton - not a corpse of an dead humanoid.
As they no longer have the humanoid type, they are no longer valid targets for animate dead.
Without a mechanic that all undead creatures who were once humanoid revert to being a humanoid at death, their creature type remains from what they were when they died: undead.
Is pile of bones separate from corpse of medium or small humanoid?
It could be interpreted as a [pile of bones] is completely separate from [a corpse of a small or medium humanoid], but that seems kinda strange.
It means you could take the corpse of a large humanoid, remove the flesh, and now all of a sudden it's a legit target? That doesn't seem like the intent and the reading that the bones or corpse must be of a medium or small humanoid makes more sense.
As always, a GM can allow the reanimation of the bones or corpse of an undead. I don't think it'd be massively imbalanced, and would help those who use those types of spells to re-use their undead army.
This is also supported by the published guidance in the Sage Advice Compendium that states:
[NEW] Can I cast animate dead on the humanoid-shaped corpse of an undead creature such as a zombie or a ghast? When animate dead targets a corpse, the body must have belonged to a creature of the humanoid creature type. If the spell targets a pile of bones, there is no creature type restriction; the bones become a skeleton.