If a permanent leaves the battlefield this way but ends up in a zone other than a library (most likely because it's a player's commander in the Commander variant), it's still counted to determine how many cards to reveal.