Wut. The girl/guy (sanan) was still retelling a story he heard before up to the end or he is making up a fanfic along the way? I guess he is now a gardener goblin there in the forest he conjured or something?
Yeah, this one was particularly confusing because the child daydreams up stories throughout based on the stories his captors tell him. Sanan was the prince's son, taken hostage as a baby but not knowing any of that. He wound up creating the oasis as penance for (his imagined) betrayal of his captor's nation.
The captors raising him as a girl is possibly to hide the prince's son's location from anyone who might find out a "girl" is being held in captivity.
At least, that's my take on it!