As I understand, Posse comitatus is to prevent the military from acting as police. Defending the border against an invading army is certainly within the scope of the military.
Apples and oranges. Has nothing to do with this situation.