“[Tex. R. Civ. P.] 91a limits a court’s factual inquiry to the plaintiff’s pleadings but does not so limit the court’s legal inquiry. In deciding a Rule 91a motion, a court may consider the defendant’s pleadings if doing so is necessary to make the legal determination of whether an affirmative defense is properly before the court. . . . Rule 91a permits motions to dismiss based on affirmative defenses [here, attorney immunity] ‘if the allegations, taken as true, together with inferences reasonably drawn from them, do not entitle the claimant to the relief sought.'” Bethel v. Quilling, Selander, No.18-0595 (Feb. 21, 2020).