There are some problems. The problems aren't exactly that the ability is too good. The problem is that you're trying to build something to improve in-combat healing, but people who read this are going to see it as a way to do pre-combat buff spells without requiring concentration.
The first problem is that your requirement "whenever you use magic to restore one or more hit points to a creature" is easily gameable. Thomas Markov's answer highlights this issue when he starts with: "If I punch my friend in the arm for 1 damage..." This needs to be replaced with a better requirement that won't get gamed.
The second problem is that you haven't placed a time limit on the temporary hit points. As written, the cleric could overheal each of their allies at the start of the day, and then they just walk around with extra hit points until they need them. (The rules say that, by default, temporary hit points last until you finish a long rest.)
The third problem is that, as you note, certain high-level spells give out very large amounts of healing, and this wasn't seen as a design problem because the people designing those spells expected them just to heal the target to full hit points. You're going to need to add rules to handle this, or else exclude those spells from this ability entirely.
The fourth problem is that the ability is pretty weak, because most spellcasters only use healing on characters that are very damaged, so the risk of hitting someone's hp cap is normally quite low. One fix might be to make this into a "half feat" that also gives +1 stat.
I think the ability you want to design looks like this:
You gain the following benefits:
When you take this feat, increase your Wisdom or Charisma score by 1,
to a maximum of 20.
Whenever you use a spell of 5th level or lower to restore hit points
to a creature, if the creature was damaged by an enemy within the
last minute, then any healing that would exceed the target's hit
point maximum is instead gained as temporary hit points. The target
loses any remaining temporary hit points from this feat after 1
With this rules text, the ability is no longer viable as a pre-combat buff spell. The spell level restriction excludes heal and mass heal from the effect.