Heritability: a counterfactual perspective