What purpose does the second entry serve? Why are they making us go through the hassle of entering in a random character string twice, when we can clearly see it the first time we type it in?
It's simple: their design makes no sense.
Entering something twice has a purpose when there is no recourse if you get it wrong the first time:
This problem doesn't exist for confirmation codes--if you enter it wrong the first time, the system should simply let you try again. Of course you wouldn't want to let someone try again indefinitely, since they could try to guess the code. But there is no harm in letting the user try a handful of times to get it right. Alternatively, the system could always send a new confirmation code.
Sometimes these odd UX choices don't come directly from the designer but rather from legal or another group within an organization. It's common to see these patterns when dealing with security & authentication.