In the case of your XML, it's following logic perfectly then.
Try this: it should equip/tell you your TP set is on if you don't have a pet out. Otherwise, it'll tell you that your Pet TP set is on.
If you want it to tell you that both of your sets are equipped (instead of one or the other), then I doubt there's a better way of doing it than you have now.
Code xml
<equip when="engaged" set="TP" />
<addtochat when="engaged">TP set Equipped</addtochat>
<if status="Engaged">
<equip when="aftercast" set="TP" />
<if PetIsValid="False">
<addtochat when="aftercast">TP set equipped</addtochat>
</if>
<if PetIsValid="True">
<equip When="Engaged|Aftercast" Set="PetTP" />
<addtochat when="aftercast">Pet TP Set Equipped</addtochat>
</if>
</if>