Will a yeast infection come back after treating one? And should a woman pee before & after sex or just after?

Possibly. There is always a change a yeast infection could recur. The rationale for peeing after sex is to wash out any harmful bacteria that could have been introduced into your urethra during intercourse.