In theory, I suppose you're right. The salamikazes could use the porous border to cross into the US and stage attacks. That's precisely why it's important to control and know who crosses, where they are, and when they leave.
However, there have been no terrorist attacks originating from across the southern border, and the vast majority of the illegals who cross the border are not terrorists in the first place.
So it is incorrect to say that the two issues are "intricately intertwined." Both serious issues, and both need to be dealt with. But they're not the same issue -- they have much different causes.