core: Improve/simplify handling of required headers.