The thing to bear in mind is this standard is used for a number of different purposes historically that has informed territories and other "non"-countries being added.
For example, it is used by postal services for routing physical mail. A lot of far flung island dependencies are coded individually because their mail wouldn't route through their mother country but through other ports.
The addition of "EU", while not a country, reflected the needs of the "EUR" currency code when the Euro was introduced (the first two letters of ISO 4217 currency codes are derived from the ISO 3166-1 standard).
The standard provides codes for such places since different law often applies in territories and on islands.
(See also: UM, TW, EH, AQ, SH, SJ, and many others.)