Add pluggable validation for PathBuilder

Fixes #975