Interesting question. Quirk et al list it as a postposed predeterrminer or pronoun here. However, they say that when in this structure 'all' takes the position of a medial adverb: They all won their matches.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
"All" in this sentence is a postposed predeterminer because it is modifying the subject, "they." It qualifies "they" but occurs after the verb instead of before the noun it modifies. You can imagine this sentence as equivalent to "All of them are five years old."
In other words, it is an adjective being used in an adverb's location in the sentence.