I actually think he thought Trump was going to lose and wanted to look principled and run in 2020. I think that was also Ted Cruz's initial calculation, but then he realized that Republican primary voters would hate him in 2020 so he changed course and endorsed Trump (still thinking Trump would lose and he'd run in 2020).
Cruz endorsed Trump because the Mercers threatened to fund McCaul in the 2018 primary.
Kasich is historically very, very arrogant and thought that A) Trump was going to defo lose and that B) he could profit from it.
This. Would bet bottom dollar John Weaver was behind this as well in some way.