I see two ways to rule it.
- The max cap is always applied.
- The effects are ordered according to how you activated them.
I say these are the two ways to rule it because these are the ones consistent with getting an ability to 20 through ASI and then increasing it above 20 with magic items.
Through strict reading of the effects (RAW), the second way seems to be the correct one. I'll now explain how these ways work in your scenario.
First way
Your charisma is 22. This one is straight-forward. I mention this way of ruling because some DMs and players might feel annoyed that, for example, getting 20 to a stat through ASI and then getting DoMT gets you to 22 while if you get the DoMT before you reached the cap you can't increase it to 22 through ASI. "I wish I got this magic item later."
Second way
In this case, we have two scenarios. In the first scenario, you initially increase your Cha to 20 through the DoMT, then try to use the Ioun Stone. In the second scenario, you have the Ioun Stone active and then get the DoMT. Notice that eventually the stone will fall from your head and you go back to the first scenario.
First Scenario
Your charisma is 20 and you can't get it to 22. Say you had 18 Charisma. You activated the effect from DoMT
Star: Increase one of your Ability Scores by 2. The score can exceed 20 but can't exceed 24.
Now your Charisma is 20. Note that this is not worded as "Your ability score cap becomes 24", it just states that this increase on your ability score can get it to more than 20.
Now if you try to activate the Ioun Stone
Leadership (Very Rare). Your Charisma score increases by 2, to a maximum of 20, while this marbled pink and green Sphere orbits your head.
But you are already at the maximum of 20, so it does nothing.
Note that even if you had an effect such as Primal Champion feature from Barbarian
At 20th level, you embody the power of the wilds. Your Strength and Constitution scores increase by 4. Your maximum for those scores is now 24.
the Ioun Stone does not state "to a maximum of your cap", it just says "to a maximum of 20".
Second Scenario
You had 18 charisma, activated the Ioun Stone, getting to 20 Charisma, since you can do it to a maximum of 20. You now get the DoMT ASI, getting you to 22 Charisma, since you can increase to a maximum of 24.
When the Ioun Stone drops off your head, you go back to 20 Charisma and you are in the first scenario, which won't let you get to 22 Charisma again.
TL;DR:
By the way I read RAW, you could get 22 charisma for some time (Second Scenario), but eventually you get stuck with the 20 Charisma.