Calendars are different than time. It's a little hard to think about; maybe this will help:
The earth is sort of an inertial reference frame with a single proper time. It isn't exactly, because it's orbiting, in varying gravity, and spinning, and has local gravitational changes, etc, but to a decent approximation you can write down an average time for the whole earth, which is the number of seconds since the epoch. That time is TAI.
Calendars and dates are things like "June", "Monday, "12:40:70.534 PM", etc. These are human-friendly names for times, and don't have to be precisely comparable. It's OK to have "12:00 AM" twice. It's not OK to have "143563534 seconds since Jan 1st 1970 00:00:00" twice.
Calendars are supposed to line up with things like seasons and days. Those don't last a fixed number of seconds; the earth is always changing. So we need to have a translation between earth-average-time like TAI, and human calendars/dates/times. There are a whole bunch of layers of translation between various time schemes; most of them derive from TAI and add some offset. UTC is basically TAI plus leap seconds, which keep UTC as "86400 times the number of days since the epoch, plus the number of seconds since midnight." POSIX time is derived from UTC. Local time is typically derived from UTC plus a timezone offset, which can also be modified by daylight savings time.
Those translations need to change and be updated over time, so we insert and remove leap seconds, leap days, etc. It doesn't change TAI, but it does change the mapping from TAI to human times.
Back when POSIX was being codified, we made the decision to base most computer clocks on UTC, which is a human time, subject to changes in that mapping. That introduces disagreement over what a given time means, discontinuities, reversals, etc. All of those make it difficult to do calculations around time correctly.
This part seems a little muddy. UTC isn't a number of seconds since an epoch, it's a number of hours since midnight, a number of minutes since the beginning of that hour, and a number of seconds since the beginning of that minute.
Accordingly, UTC can bend the rules by saying, for example, that just this once the second 23:59:60 exists before midnight. It refers to a different second from 00:00:00; only when converting into POSIX does that become ambiguous.
So UTC and TAI agree on the number of seconds since the epoch, it's just UTC doesn't encode that number in the current time. Going the other way, TAI doesn't encode the current solar time. You need a lookup table either way.
The earth is sort of an inertial reference frame with a single proper time. It isn't exactly, because it's orbiting, in varying gravity, and spinning, and has local gravitational changes, etc, but to a decent approximation you can write down an average time for the whole earth, which is the number of seconds since the epoch. That time is TAI.
Calendars and dates are things like "June", "Monday, "12:40:70.534 PM", etc. These are human-friendly names for times, and don't have to be precisely comparable. It's OK to have "12:00 AM" twice. It's not OK to have "143563534 seconds since Jan 1st 1970 00:00:00" twice.
Calendars are supposed to line up with things like seasons and days. Those don't last a fixed number of seconds; the earth is always changing. So we need to have a translation between earth-average-time like TAI, and human calendars/dates/times. There are a whole bunch of layers of translation between various time schemes; most of them derive from TAI and add some offset. UTC is basically TAI plus leap seconds, which keep UTC as "86400 times the number of days since the epoch, plus the number of seconds since midnight." POSIX time is derived from UTC. Local time is typically derived from UTC plus a timezone offset, which can also be modified by daylight savings time.
Those translations need to change and be updated over time, so we insert and remove leap seconds, leap days, etc. It doesn't change TAI, but it does change the mapping from TAI to human times.
Back when POSIX was being codified, we made the decision to base most computer clocks on UTC, which is a human time, subject to changes in that mapping. That introduces disagreement over what a given time means, discontinuities, reversals, etc. All of those make it difficult to do calculations around time correctly.