You seem to completely discount the fact that Cruz has been inactive for nearly two years, and has not beaten any of the current top BW contenders (for comparison, TJ went through Assuncao and Lineker before challenging for the title again).
Why does Cruz deserve the TS? Because he was the most dominant 135er ever, and only has 1 loss in 10 years. The default assumption should be that he will defeat the current top 5. There's nothing to indicate that he would lose to Moraes, Assuncao, or even Garbrandt again.
Not sure why you think he should be ranked #1 when Cody beat him decidedly.
Again, Cody beat him once. Matt Serra beat GSP even more convincingly. Was Serra better than GSP overall? Nope. An N=1 means literally nothing. It means on that night, Cody Garbrandt was better. We have no idea what factors played into that. You've got a guy in Dominic Cruz that's only 33 years old, and was at one point the most dominant 135er ever. The default assumption must be that he had a bad night. To conclude "he's done" after he lost 1 fight is absurd.
I think Cruz needs a top 5 win before challenging again for the title. Imho he should fight Rivera as originally planned, you can't just go from pulling out of a fight to a TS, especially when Assuncao and Moraes are active and beating top BWs out left and right.
In a perfect world, every single fighter should need to win a clear #1 contender fight before challenging for the title. However, that's not always possible. Sometimes you end up without a clear #1 contender and a champion that's ready to fight.
If Moraes or Assuncao wanted the title shot, they should have fought each other a 2nd time. That would put one of them in a dominant position to claim the title shot. However, they haven't done that yet. Darren Till got his title shot because he fought Wonderboy -- had he sat out, he wouldn't have gotten it.
The reality is all 3 guys have a claim to the title shot:
Assuncao: 1-1 against Dillashaw and 4 fight win streak, and holds a recent win over Moraes
Moraes: Impressive 3 fight win streak since losing his first UFC fight. But he's only 3-1 in the UFC.
Cruz: 1-0 against Dillashaw, best 135 champion ever, and only lost once in 10 years.
And in this situation, Assuncao holds the win over Moraes, so he should get it... but Moraes has a better recent win against Jimmie Rivera. With no UNDENIABLE #1 contender, it goes to Cruz by default.