Ho mangiata la pizza is the sentence of someone who has been paying attention, and nobody blinks at it. You have done the hard work of learning that Italian endings move (that an adjective follows its noun, that stanca is not stanco), and the pizza is feminine, so the ending went with it. The instinct is right. It is pointing at the wrong word.
The past participle has one thing to look at, and it is not the object. It is the auxiliary. With avere, the participle does not change: ho mangiato whoever you are and whatever you ate. With essere, it behaves like an adjective and agrees with the subject. That is the whole rule, and the rest of this post is a consequence of it.
So ho mangiato la pizza keeps its -o even when the speaker is a woman and the pizza is feminine and singular. Avere is there, so the participle is inert. The moment the verb takes essere instead, as verbs of movement and change do (andare, venire, arrivare, partire, uscire, nascere, diventare), the ending wakes up and follows the person doing it.
Ho mangiato la pizza.
Maria ha comprato le scarpe.
Maria è arrivata tardi.
Plurals work the same way, which is where the agreement becomes audible. Siamo arrivati alle otto, we arrived at eight, with -i for a group of men or a mixed group, since Italian treats any mixed group as masculine. A group of women says siamo arrivate.
Le ragazze sono uscite.
The fix, then, is not a new rule to memorise but a redirected glance: before you choose the ending, look left at ho, hai, ha against sono, sei, è.
The edge that trips people up
There is one place where avere does make the participle agree, and it is common enough that leaving it out sounds foreign. When a direct-object pronoun (lo, la, li, le) comes in front of the verb, the participle agrees with it. Not optionally: this is the standard, and Italians do it without noticing.
L’ho vista ieri.
Le ho mangiate tutte.
Ho mangiato le paste and le ho mangiate describe the same afternoon, and the ending differs because in the second the object walked round to the front of the verb and became the thing the participle describes. The same happens with a masculine plural: ho comprato i biglietti, then li ho comprati.
The other pronouns behave differently. With mi, ti, ci, vi as direct objects, agreement is optional rather than required: ci ha visti and ci ha visto are both heard, and nothing forces you to choose the agreeing one.
Reflexive verbs are a separate case, and an easy one, because they take essere. Lavarsi, svegliarsi, alzarsi, divertirsi all form the past with essere, so the participle agrees with the subject exactly as arrivare does. Si è lavata, she washed. Ci siamo svegliati presto, we woke up early. Learners who have absorbed “reflexive means essere” get these right without thinking about agreement at all, which is fine; the reason it works is that the subject and the object are the same person, so there is nothing left to disagree with.
Modal verbs sit on the same fault line. Ho dovuto partire and sono dovuto partire both exist, because a modal borrows the auxiliary of the verb it carries, and partire takes essere. If you use avere, nothing agrees; if you use essere, the participle agrees with the subject: è dovuta partire. Both are correct, and which auxiliary a verb takes in the first place is the subject of the post on sono andato against ho andato.
How to hear it
The participle is describing something, and which word that is settles the ending. With essere it describes the person doing the verb, so it moves with them, and you can feel that in the sentence: Maria è arrivata is Maria-shaped in a way that Maria ha comprato is not. With avere the participle describes nothing at all. It is only the verb, so it has no ending to negotiate.
Then keep one question for the exception, and keep it small: is there a lo, la, li or le just before the verb? If yes, the participle agrees with that pronoun. If no, and the auxiliary is avere, the participle ends in -o and stays there.
There is a consolation buried in this particular mistake. The -a you reached for in ho mangiata la pizza is not a wrong ending. It is an early one. Move the pizza round to the front of the verb, as Italians constantly do, and the language hands the ending straight back to you: l’ho mangiata. The instinct that produced the error is the instinct the sentence needs one word later, and once you have heard that, ho mangiata la pizza stops sounding like a rule you broke and starts sounding like a word that arrived half a beat too soon.