Ted Cruz is an independent person who has independant beleifs and morals. He does not believe that Donald Trump would make a good president. Cruz has no intentions of running for President in the 2016 race, so not endorsing him would not really benefit him one way or the other.
Ted Cruz is allowed to endorse whomever he likes. If he doesn't want to endorse Donald Trump, that is his decision to make and people should respect it. It's not a matter of being selfish or not, but a matter of who Ted Cruz believes in. If he doesn't believe in Donald Trump, fine. As long as he doesn't vote for Hillary!
There's nothing selfish about Cruz's refusal to endorse Donald Trump. There's simply no reason to think he would be obligated to give such an endorsement. If Trump hoped for an eventual endorsement, he shouldn't have made personal attacks against Cruz's wife and father. Trump got what he signed up for with his conduct during the primary.
Ted Cruz failing to endorse Donald Trump during his speech is a smart move because it is political cover for Cruz when he runs for the Presidency in 2020. Cruz is simply sticking by his convictions and doing exactly what he said he would do. The surprise is that anyone is actually surprised by this.