The only thing that could be going through Cruz's mind is the possibility of the establishment grudgingly arriving at the conclusion that if they put up a Ryan or Kasich or Romney type of nominee, millions of GOP-registered Trump and Cruz voters will leave the party en masse, greatly diminishing their power. And that they'd they'd lose far fewer voters if they nominated Cruz instead. It's a longshot, but his only shot. That's what keeps him in the race.
Most would agree that Trump’s base is the broadest and most intense (as evidenced by his massive turnouts and having 7.5M votes vs Cruz’s 5.5M votes vs Kasich’s 2.7M votes), therefore screwing Trump out of the nomination if he has less than 1237 heading into the convention would be suicide for the GOP from POTUS, Senate, House and the state level. A heck of a lot of Trump voters will not show up if they feel screwed by the GOPe, including the blue collar Dem crossovers and first time voters, etc. The intensity will fall off a cliff. I think the Republican party has a better chance of winning as a populist party, especially with the Dems having moved so far left. Times change.