Stun, Daze and similar stuff don't impede your movement...
...they make your mind funny.
While you are stunned, there's nothing holding your body to move. You just can't think right to actually do something. If you take a really hard blow to your head, that won't make your body harder to move - it will make your brain go gonzo for a few secs, before you became aware of what's really happening.
Stun is not about movement, is about senses of what's going on.
Freedom of Movement makes "your body work right", not anything else. It allows you to move, but not allows you to think. You can't think if you're dead. Or Stunned.
Paralysis don't block purely mental actions, so it don't block "thinking".
Slow makes your body... well, slower, but it doesn't affect your thinking.
Web is... well, a web. It hinders your body, not your mind.
Stun, Daze, Dazzle and similar stuff, on the other hand, makes your senses go wacko, so they aren't really blocking your movement. Stun never stopped you from moving, it just stopped you from thinking for a while - and since you don't think, you don't act.
So, the point is,
If something affect your senses, Freedom of Movement can't help you.
Think like a "Houdini Effect". Houdini can escape from almost anything, considering that he
knows what's going on. If you throw him with a concussion inside a closed coffin... well... he will stay there.
So, to determine what Freedom of Movement removes or not, use a simple rule:
Why I can't move?
If you can't move because a spell or something is hindering your body to move, like Web, Freedom of Movement can help you.
If you can't move because a spell or something is making your brain go gonzo, like Stun, or because your body becomes something that can't normally move, like stone from Flesh to Stone*, it won't help you.
*Flesh to Stone don't impede your movement, it merely limits you to the movement that a stone statue is allowed to do. A "Freedom of Movement"-ed and "Web"-ed person would become a completely untangled stone statue.
Also, read Freedom, the 9th level spell:
The subject is freed from spells and effects that restrict its movement, including binding, entangle, grappling, imprisonment, maze, paralysis, petrification, pinning, sleep, slow, stunning, temporal stasis, and web. To free a creature from imprisonment or maze, you must know its name and background, and you must cast this spell at the spot where it was entombed or banished into the maze.
Emphasis mine.
Freedom removes a bunch of effects, like Flesh to Stone and Stun. It would seem rather... strange to say that a way lower-level spell can do almost all the things that a 9th level spell can. Freedom is Freedom, not Freedom of Movement.
Typically, this sort of thing is handled by DM fiat. If you want one of your NPCs to craft a magic item, then they can. The whole reason that XP costs for that kind of thing exist is to make it so players don't have an unlimited supply of powerful magic to mess around with, and that's not a problem with NPCs. In addition, specific XP values are very rarely calculated for NPCs, with the possible exception of cohorts.
The only place that I know of in all of 3.0 and 3.5 where Xp for crafting for NPCs is mentioned is on Page 29 of Deities and Demigods, where it says that gods have 30,000 XP per week that they can spend on crafting and spellcasting. If you want to keep track of NPC XP for crafting and spellcasting, then you're going to have to create your own system for dealing with that kind of thing.
That said, you could totally institute a rule that limits how many magic items NPCs can make, if you want. Maybe say that each NPC has half of the XP needed to gain a level available for crafting at any specific time, and have that amount slowly regenerate, perhaps at a rate of 5% of the XP needed to gain their next level per week or so. This is all very ad-hoc and untested, but it's perfectly viable for yo to add this kind of restriction in.
Alternately, you could let the treasure guidelines deal with it. If a particular enemy is supposed to have 750 gp worth of treasure (for example), you could instead give them a wand of magic missile that they've crafted. To the players, it makes no difference, but this way you can better justify the gear that enemies are carrying.
One thing to note, where spells with expensive material components or XP costs are concerned: spell-like abilities don't need material components or cost XP. If a genie uses wish, they don't spend any XP to do so, they just cast the spell. If a demon has the spell-like ability to grant a wish, it doesn't cost them anything to use.
Best Answer
Study, Study, Study
Information is really the only way to overcome this problem, and it comes in a few varieties:
Know Your Players - This one is the most important. You should familiarize yourself with the capabilities of the PCs and with the tactics they tend to favor. Do they search a room when they walk into it before they do anything else? Does the party wizard like to summon? What is a Factotum anyway? This is the single-most important consideration because it helps you to determine what kinds of monsters they might enjoy fighting, where the strengths and weaknesses of the PCs are, and most importantly how you can challenge them without automatically throwing their characters into the killing pit. An important distinction to make is that a player's character might be capable of doing something that they have not, to date, done. Plan for their current tactics, but keeping the capability in mind for later will help you adapt, and can also help you if you want to teach your player how to use it.
Know Your Monsters - This is a lot like knowing your players, except for monsters and NPCs. However, you have additional considerations - how intelligent is the monster? How wise? Can they cast spells, and how often? Does their entry list any preferred tactics, and are those tactics intelligent? If the monster is mindless, can it be directed by another monster that can give it orders? Pre-built monsters are rarely designed in an optimal fashion, but you can increase or decrease their power level by changing around even such small things as the items, feats, or skills the monster is trained in.
A very important consideration is to look at how intelligent a monster is. Let's take the Erinyes as a specific example of doing the above. The Erinyes is a CR 8 devil (an embodiment of Lawful Evil), which means that in theory four of these lovely ladies is an appropriate boss fight for a level 8 party. The first place I look when deciding how to characterize this monster is her alignment (Lawful Evil) and then her ability scores, which are listed as "Str 21, Dex 21, Con 21, Int 14, Wis 18, Cha 20". What this tells me is that, compared to humans, the Erinyes is unnaturally strong, quick, and tough. That 14 intelligence indicates that they're smart and cunning but not genius-level intellects like a wizard, but her exceptional Wisdom means that she's perceptive, quick on the uptake, and aware of her environment, while her 20 charisma speaks of unbreakable self-confidence, self-assurance, and a strong self-identity (which, since she's Lawful, might indicate discipline, restraint, and a sense of patriotic pride in Hell). So right there we can reasonably say that this monster is going to try and use effective tactics, take full advantage of her natural and supernatural abilities, and come at the party from odd angles.
Little Details - Relating to the above, you want to familiarize yourself with some of 3.5's terminology so you can know it at a glance. Keeping with Erinyes, above, we can see that she's an "Outsider [Extraplanar, Evil, Lawful]", which while it doesn't have further explanation in the entry causes her to be strong - or weak! - against a variety of spells and abilities all by itself. If it helps, print out pages or cards explaining what the abilities of a monster do before you run an encounter with it. Look at how a monster might use their abilities in a synergistic fashion and spend their entire turn doing stuff instead of just part of their turn. A great example for this Erinyes is combining her power to fly and her longbow, or her at-will Unholy Blight ability, which puts her out of the range of non-ranged attackers and lets her rain down death with impunity. She's immune to fire, so perhaps she might use her flaming arrows to burn the building the PCs are fighting in, or confront them in the midst of a blazing wildfire, trusting in her fiendish nature to protect her while they're forced to spend resources avoiding the flames.
Of help in these considerations is the System Reference Document, and specifically the Types and Subtypes, Special Abilities Descriptions and Spells section.
The PCs Don't Have to Kill It - A lot of monsters and spellcasters have unparalleled ability to run away. Whether it's an Erinyes teleporting to safety, a worm-like creature burrowing away or a sorcerer invoking a flight spell to escape combat, most villains and monsters don't want to stick around to be killed by adventurers. This doesn't have to be a bad thing - not only does it potentially give you a recurring villain, but the XP system in 3.5 rewards players for overcoming challenges, not for killing monsters. If they make the fiend flee, then they're overcome the challenge. Additionally, the ability to teleport to regroup can make for a more extended encounter as the PCs deal with recurring harassment by a determined enemy until or unless they can pin it down and force the end of the battle.
Another interesting option for this is the monster or NPC surrendering. Aside from letting players with certain concepts (like a bounty hunter, or a merciful paladin) indulge in the ability to turn an evildoer over to justice or help them on the path to redemption, this can be a way to further the story. A great example is in the module Expedition to Undermountain, where the players encounter a Mimic. If they defeat it, it surrenders and begs for its life, offering to report on the activities of people that pass through its hallway in exchange for food. In this fashion a monster or NPC still gives XP to the player characters, but also can become a long-term ally (even if it's a difficult ally) or a beloved companion.
3.5 Has No Aggro Mechanic - This one is the biggest source of people wondering why a supposedly strong monster is weak. A common misconception people have about 3.5 is that, like World of Warcraft or Everquest, the guy wearing armor is automatically a more appealing target. Nothing could possibly be less true, especially for an intelligent monster. Why should a flying monster stay toe to toe with the fighter (and get cut to ribbons for the trouble) when she could fly, ignore him, and take out the dangerous sorcerer? There's no mechanic that lets fighters or other melee types "hold aggro", which means that an intelligent monster will assess threats based on what's happening, their own experiences, and their Knowledge ranks. Demons and devils, for example, will go after clerics and wizards because they know those dangerous beings can banish them back to the Lower Planes, while the sapient-but-sorta-stupid orc might prioritize a fighter or cleric first out of a desire to fight a great warrior. In most cases, however, a monster or NPC will target whoever is making themselves the biggest problem, so if a melee concept wants to hold down aggro they need a reason to make monsters care about them or a way to control the battlefield enough that the monster must needs go through them to get anywhere.
And, finally, Even Smart Monsters Can Be Stupid - Yes, part of the point of this guide is to encourage DMs to play intelligent monsters up to their potential, which can lead to more tactically interesting games. However, D&D is also a roleplaying experience, which means that personality is part of it. Yes, the Erinyes is incredibly clever - but she's also incredibly Lawful and incredibly Evil, which means that she might be operating under oaths of service that restrict her, or that she might get sloppy in an undercover operation because she took the chance to torture a homeless man to death instead of covering her tracks. Unless your game is high-optimization (in which case, by all means, pull out every stop you have) these sorts of little mistakes both help slate the odds towards the PCs and help flesh out the personality of the monster so that they're not just a generic being.