How to protect PEX pipes from puncture
Usually around here these pipes are in corrugated plastic conduit. Same for wires.
The conduit is free to move around inside the drywall, so it you drive in a screw (or a drill bit) it will scratch the conduit but it will push it out of the way instead of going through.
Here's an example (European metal drywall studs, not US wood studs, but you get the idea):