You didn't do anything wrong as far as Bairdotr's quest goes. Don't take her into the cave, or attack before the conversation gets triggered, and you can avoid her leaving.

BTW, there is currently an issue when she leaves as part of the quest that your party size doesn't get adjusted properly, so you can not replace her with a different companion or henchmen. That will be fixed in a future update.