Fanaelialae
Legend
Why there's a pit there at all matters. There's a difference between something that develops naturally from the world, and something that is heavy handedly done to teach the players a lesson. (Don't try to teach your players lessons. If there's a problem, simply talk to them.)The character learned how it works & that's why they got a warning about needing something with more concretely linked than than a mere casually linked random object. If the player chooses to tempt fate & argue with an uncaring universe about why a casually linked object is good enough that's a different matter which may or may not bring consequences left for fate & the universe to decide without negotiation. "it doesn't say it needs to be more firmly linked" is the same as "it doesn't say that it shouldn't be more firmly linked." There's a difference between the gm plonking the party in a bad situation & the party plonking themselves in a bad situation they were warned about but chose to do anyways... The difference is who held the shovel & dug the pit.
In your example, a super-powerful NPC wants to capture the NPCs, and contrives a plan to force them to teleport into an inescapable cell. Would this NPC even be trying to capture the PCs if the wizard had learned Forcecage instead of Teleport?
If the NPC wouldn't be trying to capture the PCs based on the selected spell, then that certainly suggests some extremely questionable motives on the part of the DM.
If the NPC would be trying to capture the PCs either way, then there are arguably better ways to go about it. The teleport plan is extremely convoluted.