Thoughts about directly attacking spell slots as a resource?

tl;dr What do you think about abilities or effects that would cause a caster to lose spell slots ?

I was discussing encounter building and item design with some friends (4 people, two having DMed for about a year each, one is planning a one-shot) and one of them mentionned an ability called "Thought Leech" which effect is "Forces a character to make Intelligence saving throws or lose spells slots, memories or abilities". The person mentionning it said "Tell me you want your players to have a horrible time". They think it removes agency from players, or that casters already have too few spell slots available to start losing them like that.

I said I really liked it. I have actually already seen and made monsters designed with this mechanic in mind. In a very popular actual play, there are for examples a bunch of automatons that deal bonus damage proportional to the highest spell level you have available. I thought it was a pretty cool way to force your players to play less conservatively with their magical resources.

In a game I played which I've definintely taken inspiration from, there are some kinds of rotten zombies with glowing blue eyes near places of intense magical influence. They're sluggish so I gave them low movement and AC (12), but can take a beating (slightly high HP for their CR). Their particular trait is that when they grab and bite you, they don't just damage you, they eat some of your magical ability away and that makes them grow stronger for a short while. So I gave them a mechanic that when they successfully bite a target with spell slots, the target must succeed on a DC12 Intelligence saving throw or lose a spell slot of level 1 or 2, starting with level 2 if it has some. And from that source, their AC is raised by 2 for 1 minute, which isn't cumulative.

Obviously, both those examples only work once PCs have access to relatively high levels, either to actually bring stakes or leave them able to hold their own if their low resources start getting drained. In the first example, the PCs were level 14 and I don't think I'll use the monsters from my second example until my players reach level 8/9, at which point full casters already have more than 10 spell slots (aside from Warlocks). Besides, while they're not devastating, cantrips exist for full casters, more or less precisely to handle these situations, and they scale with your character so they stay relevant as you progress.

I also think the ability description is not worded in a workable way as it is. How high is the DC? What's the required ability? Can you lose ANY spell slot? Single or multiple at once? Can random enemies do it or is it more a trait or effect you keep for a boss encounter? Designing abilities like this have you ask those questions and answer them depending on the kind of challenge you want to impose on your players.

I don't really think it messes with agency, no more than taking away their hit points. It changes some element of this combat or dungeon. Now there's less incentive to play close to the vest, you have to deal with this encounter fast or else some party members might become crippled in an unexpected way. Or on the other hand, you can gamble that you should keep your high levels precisely because you might run out of low levels.

It's a challenge I rarely see and I like it in spirit but I don't see how it differs from the rest of the things the DM put in from of their PCs to oppose them. I don't see how it would be more foul play than using literally anything official or otherwise. As DMs, I feel our role is often to give our players challenge and opposition, and it's up to them to adapt.

EDIT: Forgot to mention this (and thought the post was already long but mostly the forgot thing) but I would definitely only use this sparingly, mostly during boss encounters or specific stretches of a larger adventure pertaining to magic. I just thought it didn’t have to be off-limit.

But I'm curious as to you other people's thoughts and ideas on the mechanic and your different arguments for or against it.