You Cannot Pass! only cares that the second creature was a legendary creature at the moment it blocked or became blocked by the target creature. If that legendary creature has become a nonlegendary creature (perhaps because it's no longer your Ring-bearer) or left the battlefield, You Cannot Pass! can still target the first creature.

Artwork
Loading artwork…
You Cannot Pass!
The Lord of the Rings: Tales of Middle-earth · #38 · EN
Nonfoil—Foil—
Card rules
Destroy target creature that blocked or was blocked by a legendary creature this turn.
It raised the whip, and the thongs whined and cracked. Fire came from its nostrils. But Gandalf stood firm.
Uncommon · Illustrated by Leonardo Borazio
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Timeless Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Future Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
You Cannot Pass! can target a creature that's currently blocking or being blocked by a legendary creature, or one that blocked or was blocked by a legendary creature earlier in the turn.