OK, let's run with what you're claiming then, because it's accurate. A lot of the successful Muslim terrorists are often second generation immigrants. So let's see the possible answers to this problem.
One, we just stop all Muslim immigrants/refugees. Sure, there is now no longer a possibility of second generation immigrants becoming terrorists because there are no longer any immigrants. However, you now create an equally dangerous probability that these immigrants and their children that you are denying entry will now be stuck in war zones or under IS control. And they will see their circumstances, and a lot of them will look for reasons for their misfortune. As much as the U.S. wants to avoid this, they have been, and are, one of the major destabilizing powers in the region. It would not be far fetched to claim that they could easily radicalize in such an environment against the U.S. And these conflicts that create these refugees will not end nicely. Even if they resolve in our favor, it is highly improbable that radical forces or ideology will disappear with them. These radicalized people will disappear into the population. So do we keep blocking immigration from these countries? When, if ever, will we allow immigration from these countries? What stops these radicalized individuals from getting citizenship in another country then applying for a tourism visa in these less scrutinized countries?
As it should be becoming clear, mass immigration bans to prevent a terror attack caused by immigrants or offspring of immigrants is not a long-term, or even necessarily a short-term, solution. It makes the population available for indoctrination or radicalization grow and fails to stop a dedicated individual from getting into the country through other legal means. If anything, it can cause more harm than good in the long-term with little to no benefit in the short-term.
Which leads to another problem. If second generation immigrants are the main people who become radicalized, then implementing a travel ban will not stop any radicalization of people who are already in the country. If anything, it will provide fuel for radicalization, because the travel bans are very easy to construe as discrimination. So it stands to reason that a travel ban not only hurts in the long-term in preventing radicalization, but also may provide fuel in the short-term for radicalization.
Which I know will lead to people saying to just deport these people, but that's illegal. They are natural-born citizens of the U.S., and deporting somebody based on their religion is a violation of the Constitution. Deportation is only possible if you can prove that they have violated a law in some way, and guilt by association is not applicable under the court of law.
I could go on, but it should be abundantly clear by now that a travel ban does not effectively protect this nation from Islamic terrorism.
If second generation immigrants are the primary population who become terrorists, then it would stand to reason that the better solution is to target the demographic with social services. Radicalization does not happen often in a person who is well adjusted to their environment. Radical views form in the face of discrimination, perceived or real, lack of opportunity, and other isolating events. And Islamophobic attitudes in the country only perpetuate this isolation. People are born normal, it's through being rejected and isolated by their country and community that they become disheartened and susceptible to radicalization. Rather than try to remove these people from the country, it would be more effective to reach out to these people to prevent them from becoming radicalized in the first place. And it would certainly be more effective than confirming their beliefs on being unwanted or rejected by society by imposing a travel ban on the basis of location or religion.
Also, correlation doesn't mean causation. The vast majority of second generation immigrants do not become radicalized, the vast majority of refugees are not terrorists. After all, if correlation was all that mattered, then I could rightfully say that all terrorists have been humans, therefore all humans should be banned from living in the U.S. Obviously, that's a stupid conclusion, but it illustrates that correlation can be a trap when reaching a logical conclusion. If the correlation is too general, then it will likely not contribute anything to a logical conclusion. Immigration being correlated to terrorism is, likewise, too general, in addition to the correlation being rather weak. The vast majority of immigrants and their families do not become radicalized, and the majority of radicalized people are not immigrants. Domestic terrorism is still alive and well.