A paedophile who admitted sharing thousands of disturbing images of children, including newborn babies, co-authored a “coming out guide” championed by Scottish schools.