Even if Trump is “joking”, it’s that half-joking or trial-joking that bullies and fascists always do. Their humor is intended to be intimidating, and that’s what they find amusing about it. It’s “a joke” as long as they don’t have the opportunity to make it real, but if the opportunity arises, they will make it real. Other countries shouldn’t take Trump’s “jokes” about invading them or seizing their resources too lightly, and I hope they’re talking to one another about contingency plans since the USA can no longer be trusted as an ally.
He’s angry that the GOP might cut off his supply of cheap, vulnerable, exploitable H-1B workers. Otherwise, racism is still his thing.