Grafting heterogeneities rule water intrusion and extrusion in nanopores