I think we can all agree that whatever deal Tyrion made, it involved Cersei's (alleged) child. Which I personally think she doesn't even have, but whatever.
It's possible he simply promised safety for the child, but then the successor talk and Tyrion's weird behavior towards the Jon/Dany hookup doesn't make sense. It also doesn't make sense why they would conceal that info from the viewer when it isn't very shocking.
Putting aside "logic", the only thing that fits all the scenes/acting we've been given is that Tyrion made a secret promise that somehow involves Cersei's kid in the line of succession. Now maybe Cersei also lied and told Tyrion she knew it'd be a boy, in which case Tyrion promised her a marriage, or maybe it's just a straight "adopt" this kid and it'll be next in line.
At this point I doubt Tyrion cares whether it gets him thrown out or killed. Or, to put it better, he cared more about getting a deal done at the moment. Even if Dany rejects his terms once she learns of them, she can reject them AFTER the undead are done.
Why would Tyrion trust Cersei? Because caring for her children is the only consistency Cersei has shown. What he doesn't know, and why she betrays him, is that she doesn't actually have a kid.
So, yeah.