Self-folding mechanics of graphene tearing and peeling from a substrate