I see. Is this the only reason, though?
No, of course not. Fundamentally the reason to have an army is to achieve strategic goals. Only a small subset of strategic goals can be fulfilled by defending in a siege. As a general principle, you cannot win by defending. As Brett Deveraux points out in his articles on siegecraft, once the siege is invested, what remains is to negotiate the conditions of surrender. Meeting the enemy in the field of battle is a tactic in that negotiation. If you believe you can inflict disproportionate losses, or if meeting the enemy with disrupt their investiture of the siege, it makes sense to do so.
Sallies - "meet the enemy in the field of battle" can be misleading. It may make sense for the defenders to sally forth and raid against the attackers, then retreat back to the castle in a form of asymmetric warfare.
If the siege is about to be relieved, (allies come to support you against the besieging forces), then it makes sense to sally forth and meet the besieging forces in coordination with the allies in the hope of inflicting loses that the besieging forces cannot sustain (undermining their ability to achieve their strategic goals).
Morale - It is possible that a limited engagement could affect your adversary's morale more than yours. (remember that soldiers die, but armies route; the goal of military conflict is not to kill the enemy, but to reduce their ability to achieve their strategic goals, frequently by reducing their morale). For example, if you believe you can humiliate or defeat critical individuals on the opposing side, it may make sense to take losses in order to inflict greater losses.
To escape - It may make sense to leave your castle, fight a limited engagement and then ride to relieve another siege; you'll take some losses, but less than if both sieges conclude successfully.
As a final example, if your goal is to take the throne, and the heir you're supporting is bottled up in a castle, it doesn't make a difference if the men in your castle are worth 20, or 200, or 20000, so long as that heir is bottled up in the castle, you've already lost. Your strategic goals require mobility.
"one man in a castle is worth 20 men outside it". is a principle. Modelling any form of conflict with a single principle is foolish. Situations don't rise to military conflict if they can be resolved simply; they are, almost by definition, wicked, complex, difficult problems that involve multiple competing principles.
In the general case, the principle, "Achieve the strategic goals" dominates the principle "one man in a castle is worth 20 men outside it".