It certainly works to the political left and Democrats' favor for it to be public with the way Trump has a knee jerk reaction to such things. It allows them to show him to seem unstable.
His reaction is not racist, for it is valid to question as to whether people (even officials) let their background affect their judgement and fairness. And it is valid to question the prejudices of various ethnic individuals wherever they were born, in the U.S. or their homeland. American born minorities still grow up to a great degree in their native culture. They can still have sympathies for their ethnic group.
And because of the illegality of the entrance of many Hispanics into America and the attempt to decriminalize the image of it, there are strong feelings on all sides, and strong anger against Trump's stand to protect the integrity of the nation's borders and citizenry.
Trump is concerned as well that the illegal immigration issue is a political hot potato now with much immoral political correctness steeped into it. Individuals all over this country (especially on the left) are currently twisting truths and spinning lies. His charge against the judge is out of line, but his inference that, in general, such can happen is not.
We did not all want him for our first choice, but we seldom get what we want in such primary campaigns. He is the nominee now, and we need him to act like it. We respect and like his nationalist stance. It is not racist. But if the left keeps baiting him and he falls for it, they will have proven a point; and we will need that third party candidate quick. My son predicted this: that Trump would not change style because it is who he is.
It can be done, the third party, perhaps successfully, because the Democratic candidate is so weak. If the bulk of the Republicans with power and money were to leave the party and form another one and choose a good and respectable candidate, there could yet be a hero on a white horse. Washington and Reagan are dead, so my first choice is Rick Perry of Texas, strongly conservative, a former military pilot, and with a wife who would make an elegant first lady. Another choice might be a well chosen woman, possibly an ethnic minority one. Congresswoman Mia Love might be great, but she is perhaps still too new in national government. Condoleezza Rice would be perfect, but the left would vilify her on the Iraq War.