Short answer: Yes you can, but it could get complicated
Addressing the elements in reverse order:
The Soul of a Warrior Trapped in a Toad's Body
Can a character True Polymorph into itself as a means of reversing a True Polymorph someone permanently cast against them earlier? (ex: A warrior is permanently transformed into a toad. The party wizard shows up to permanently transform the warrior back into his regular self.)
First of all, his equipment's gone if you turn the toad back into a warrior.
p. 283 PHB, from the spell description.
The target’s gear melds into the new form. The creature can’t activate, use, wield, or otherwise benefit from any of its equipment.
Secondly: what is the CR or character level of the toad? When he got turned into a toad with the one hour concentration that made it permanent, that new form has new statistics, and has either a level or a CR bounded by how the spell operates.
the target's game statistics are replaced by the new form statistics including also its mental ability scores ...
If you turn a creature into another kind of creature, the new form can be any kind you choose whose challenge rating is equal to or less than the target’s (or its level, if the target doesn’t have a challenge rating).
If your warrior was ninth level, did he become a ninth level toad, a CR X toad, or what? As a point of reference: a Giant toad is CR 1, a Giant Frog is CR 1/4, and a regular frog (close enough to a toad) is CR 0.
Once the level or CR of this toad is established (work with your DM) you can transform that "once a warrior, now a toad" into a warrior (himself?) with a CR equal to or less than the CR of its current form per the spell description.
There is a potential for bad news: what is the equivalent level of a CR=0 warrior? A congressman?
The target’s game statistics, including mental ability scores, are replaced by the statistics of the new form. It retains its alignment and personality.
That last sentence opens the door to "kiss the frog and restore the prince inside." If who you are is made up of your alignment and personality and your soul (you aren't dead, you are alive, it is YOU in there, and souls* are part of D&D 5e), then "You the toad" could be a level-X warrior trapped in a toad's body.
Your DM could rule yes or no on that.
- If DM rules no, it might take a wish spell to restore the warrior to
his true self.
- But DM could rule yes based on the soul of the warrior remaining intact due to still being alive, albeit in a new form.
*Note on the soul, from 9th level Astral Projection spell:
If the cord is cut—something that can happen only when an effect specifically states that it does — your soul and body are separated, killing you instantly.
From this we deduce that while still alive, your soul -- who you are -- remains with you regardless of what form you are in. There's hope. "Who's inside that new body?" is also addressed here in the section with the title "The Vibe."
Now for the Generic question:
Who's Really In There, Inside that Body?
Can a character True Polymorph into itself (possibly after transforming into some other form first)? Possibly to prevent aging, cure wounds, or alter their original body in some way?
Once the CR/Level issue noted above is resolved with the DM, yes, as long as whomever casts the spell can concentrate long enough to do it. Once again:
If you turn a creature into another kind of creature, the new form can be any kind you choose whose challenge rating is equal to or less than the target’s (or its level, if the target doesn’t have a challenge rating).
Work that out with your DM and proceed.
For what it's worth, Jeremy Crawford(lead rules dev for 5e) had this to say about who is in there:
A spell doesn't erase/suppress your memories unless the spell's text
says it does.
When the text of a spell, like polymorph, says you retain your personality after a transformation, that's a terse way of saying, "You're still you, despite the radical changes you undergo." #DnD
Supporting point on it being "you" in there no matter what form you take.
There is a hint that "it's you in there!" in the "Creature to Object" element of the spell (p. 284 PHB) where a creature becomes an inanimate object for a while (not a permanent transformation). "You" are in there but "...the creature has no memory of the time spent in this form ..."
This can be read as being due to inanimate objects having no mental abilities. (Remember, the new form's stats are now your stats). You were in there, body and soul, but the lack of mental traits rendered memory irrelevant ... more "in a coma" than "brain death." You come out of this "coma" alive and intact, with your stats, when the spell expires.
This interpretation, you not being dead when temporarily an object, is consistent with soul and body being bound together in a live character, however impaired in terms of stats.
If the change into an object is permanent ... that's another story, or another trope.
Work with your DM.
The spell doesn't prohibit the gaining of experience, so it doesn't… at least not automatically.
You bring up some examples where it might make sense to not gain XP though: the sub-human intelligence giant bug and the alien-minded elemental. A DM might look at those and decide that the former is incapable of learning, and the latter is capable of learning but their normal mind would be incapable of applying those learning experiences later to their true form's life.
The other two examples (the minotaur and the lamia) might inspire the thought that experience gained is still useful, but not fully applicable to their true form. A DM might think that maybe they should earn XP, but not the full amount…
And maybe a DM might think that gaining XP while effectively being a member of a different class should… have an effect? Maybe it can be handled by multiclassing once returned to true form, or just wiped out, or transfered at a reduced rate…?
A DM could have all kinds of useful thoughts about these situations, which the book doesn't answer for them.
Fortunately this doesn't have to be complicated, because it's a rule that the DM can make such rulings according to what makes sense and is best for their group's game. It's their job within the game to make decisions based on real game contexts that the rules don't or can't foresee. The DM at the table is far better equipped to make choices that are best for their game than a designer far away and years in the past, anyway.
So if you're the DM: decide. If you're not the DM: ask your DM.
Best Answer
No (kinda1), because you can't stay True Polymorphed after the session ends - the effect is always dispelled.
During the session, you can keep playing the character. It's still the same entity/person, because True Polymorph says:
After the session, you can't stay polymorphed because the Season 7 FAQ updated the rules on True Polymorph:
1It's a "no" under formal logic - the statement of "legal character AND stay True Polymorphed" must be true in both parts for the answer to be "Yes". You can't fulfill both parameters (the second is impossible), so the answer to the question is "No".