He didn't set her up, he tells her not to go out of the ship because it was a dangerous place and she goes out anyway. Shit happens and she passes out. When she wakes up Thanos has brutally murdered her aggressors and laments the fact that Gamora went out in the first place.
After the incident he removes her broken bones and gives her steel bones and reroutes her tear-ducts so she can't cry anymore and the reason he does that is because he thinks he's protecting Gamora and making her stronger.
It's fucked up, but that's the point. Thanos is emotionally stunted, has trouble expressing himself, and as a parent he's terrible that even when he tried to do good for Gamora he ends up traumatizing her even more.