Ymir lived a life full of lies, knowing, and when the army found out, she was blamed for everything. She still chose to protect all the people, wanting to be seen, adored and loved, choosing to sacrifice herself so others can avoid getting punished. She only wanted a peaceful life.
She was punished along with all the people she lied to, and after eating Marcel, she decides to live only for herself, wearing a facade by trying to be mean and selfish.
She enters the church and hears "Christa's" story. She realizes that's how she was before and act selfless again by joining the cadets to find her and help her.
She wears this mask of selfishness, saying she's only living for herself, but all of her choices are still selfless. During the battle at the castle, she could save herself, but she hesitates destroying the tower and does not leave.
She knows she's about to die and leaves with Reiner and Berthlot to give back the titan, the power she stole years ago from Marcel.
Her last wish before she leaves is to see Historia/take her with them. She wants to protect her because Ymir cares a lot about her. Historia is the first person that showed her love and cared about her, even if she saw the real her. She wanted to be with her even if she knew how "horrible" she was.
This time, she chooses to take Historia because of her own wishes, because "she will die without her" or that's what she says, she still wants to save and protect Historia.
Historia tells her to take her own advice and live for herself, Ymir decides to leave, seeing that there might be a future inside the walls for Historia.
"Being a Goddess had it's perks while it lasted" means Ymir was happy for being with Historia, being seen and loved, even if it didn't last that long.