So heat rays from the sun go thru brick and warm stuff on the other side. O K I don't know what I don't know but let's look at what we do know. Termites were tracking water and came up the crack. So we know water was coming thru the brick and running down behind your wall. What is going to happens to water after you have installed foam. I am not sure I have enough info to make good suggestion. BTW foam board joints just need red TUCK tape at the joints and a caulk that is made for it around the edges. Perhaps you could look at breathable sealer for the outside of the brick.