There are a dozen ways to deal with this even if it were legal. Trump could have a substitute on the ballot who campaigns on turning his delegates over to Trump at the convention. If California can have an “uncommitted” slate, they could be elected and vote for Trump. If Murkowski can win Alaska with real opposition with write-ins, Trump could do the same with token opposition. California could go to a Caucus system.
This sounds a lot like the electoral college. It would be a real smack in the face to California if all the Republican candidates ran via "proxies".