Essi and Geralt confusion (books)

Can someone explain to me the part where Dandelion told Geralt to have sex with Essi so she would be happy and it would all be over? Like what?! Thats toxic to have sex with her, knowing she has feelings for you. Why would geralt even consider that? I donr understand? I thought it was a very good short story but this ruined it for me but maybe i missed smth.

Like..he cant give her what she truly wants, a steady relationship. He doesn't want her. Yet he fucks her anyway and leaves her after that? Great...