When a spellcaster is controlling undead that they have created, does this count as part of their challenge rating or are they considered separate?
A good rule of thumb is that anything that was prepared ahead of time should go into the CR, while anything summoned or animated normally during combat would not.
This is brought up in the official 3.5 FAQ, page 114. (It's a long FAQ!) It uses the context of whether you should award XP, but that's pretty similar.
Do characters receive experience for killing a summoned monster? What about undead created with animate dead or an outsider called with planar ally?
As a general rule, any creature whose presence on the battlefield is a direct result of another creature using one of its special abilities (such as summoning) during the battle doesn’t grant XP to characters defeating it. This is because the monster is counted as part of the challenge provided by the summoning monster. A pit fiend’s Challenge Rating (and thus the XP reward granted for defeating him) already takes into account the fact that he can summon allies; without that ability, he’d be worth less XP .
However, there are plenty of situations where a DM should make exceptions to this general rule. Any time that a creature can bring an ally into play without reducing the resources it otherwise brings to the fight (or well outside of combat) you should strongly consider awarding XP for defeating that ally.
It goes on to discuss several different scenarios, using animate dead as a specific example.
No, minions gained through spellcasting or class abilities do not count extra for their CR.
The GP value for the black onyx gems and the capability to cast animate dead, or command undead, or to have commanded undead via divine ability - all of these count as part of a character's challenge rating. Just make sure they have paid the gold for the gems (from their available treasure) and are still limited by the confines of the spell (two or four times caster level, depending on if desecrate was used).
The canonical answer to this is that anything a creature can do with its power and abilities is included in the CR. But a referee can judge that setup make the encounter harder (or simpler) and increase (or reduce) the CR but there are no rules for this only a suggestion.
For example a wizard is encountered having already used up 90% of his spells for the day might be though of as less hard to beat and I can see no reason not to reduces the CR. IMO if a creature has had chance to fully prepare its power before the encounter starts it should be treated as a harder encounter and give a CR boost, but I never been in a game where the referee has but I have see the CR reduced.