This is up to the DM
The rules do not explicitly say what happens to the creature's memory, so the DM must decide if the creature retains it in spite of changed mental ability scores, or not.
True Polymorph is often used to enact shenangians in which certain abilities of features only work on special creature types, as it allows you to be a creature of any creature type. If someone in the party True Polymorphs a fellow character into a red dragon, many groups assume the red dragon will be able to remember who he really is, and know what the character knew, just in a different shape. However, the language in the spell does not make any statements about this.
In the end, I think that the creature retains its alignment and personaltiy is an indication that the effect does not just create an entirely new creature that knows nothing and has no sense of relation towards its former self or what happened before the transformation. However, I think there is a lot of support in the rules that when you lose intelligence, you will lose memory, or at least substantial parts of it.
Support that Intelligence is needed for memory
- The intro to Chapter 7: Ability scores says:
Six abilities provide a quick description of every creature’s physical and mental characteristics: [...]
- Intelligence, measuring reasoning and memory
The Tome of Clear Thought (DMG, p. 208) contains "memory and logic exercises" and reading it increases your Intelligence.
Both the PHB (as cited by you), and the DMG on p. 237 indicate that Intelligence is used for ability checks that involve memory and reason, and Intelligence saving throws (DMG, p. 238) help you "resisting mental assaults that can be refuted with logic,
sharp memory, or both"
When a creature is transformed into a Larva (p. 63, DMG), the larva has only a few faint memories of its previous life and the statistics in the larva stat block, with an Intelligence of 6.
So intelligence explicitly measures your memory. If you reduce Intelligence from say 17 to 1, then most of your memory should be gone. There may be some vague rememberances left, enought to know whom you like or don't, but not any more detailed, complex knowledge.
Comparison to other Spells and abilities
Polymorph spell is a lower level spell, that also does not state what happens to memory. I think most players would object if their DM ruled that their opponent, transformed into a snail or frog of intelligence 1 would retain its cunning and memories to make an escape. But then, polymorph uses nearly the same language:
The target's game statistics, including mental ability scores, are replaced by the statistics of the chosen beast. It retains its alignment and personality.
Polymorph can only transform its target into a beast, so it says "chosen beast", but otherwise the wording is the same.
In contrast, the language of the druid's Change Shape ability that states they retain their mental ability scores, along with skills and class features (p. 67 PHB). The Shapechange spell also allows you to retain mental ability scores along with skills and class abilities. This makes sense because you learned who to use these skills, so they are part of your memory.