Once an ability has triggered, it doesn't matter what happens to the source (unless the ability specifically says otherwise.) So you will get to destroy an attacking creature, and return to library will trigger, but only resolve if the
Vengeful Pharaoh is still in the GY.
Now of course, if your opponent remembered it was there, they would
exile the pharaoh during the declare blockers step after you declared no blockers, so that they could save an attacking creature. But after the ability triggers, moving the pharaoh won't
cancel it.