Vyxal, 1 byte
ǐ Just the built-in. But that's boring, so
Vyxal, 16 8 bytes
K~æ~Ǒ$ẋf Explained
K~æ~Ǒ$ẋfʀ~æ~Ǒ$ẋf K~æʀ~æ # From the divisorsall ofnumbers in the inputrange [0, input], keep only those that are prime ~Ǒ # Without popping anything, get the multiplicity of each prime divisor - this leaves the stack as [divisors, multiplicities] $ẋ # Swap the two items and repeat each divisor multiplicity times f # Flatten and output that