I’m not at all sure how widespread this realization was among the republican electorate (I haven’t seen anyone produce any data), but my suspicion is that a LOT of conservatives recognized the unfettered immigration, promoted by the democrat party, is an existential threat to republican (read: conservative) elections in the future. IMHO that is why so many people you wouldn’t expect to support Trump, did (he most forcefully addressed the issue of immigration). Its also explains why the border wall and limits on immigration are such high priorities.
It is intellectually lazy to portray conservatives as xenophobic. The average republican is no more racist than the average democrat (maybe less so, remember the source of the KKK, Jim Crow and segregation). But you can’t argue the voting tendencies of Hispanic and Muslim immigrants (and their offspring) don’t overwhelmingly favor democrats.
The high-minded ideals of Speaker Ryan don’t mean a hill of beans if you’ve been relegated to the political sidelines for a generation or two by demographics.