Leaf schemes and Hodge loci