We consider the propagation of a shallow-water undular bore over a gentle monotonic bottom slope connecting two regions of constant depth, in the framework of the variable-coefficient Korteweg-de Vries equation. We show that, when the undular bore advances in the direction of decreasing depth, its interaction with the slowly varying topography results, apart from an adiabatic deformation of the bore itself, in the generation of a sequence of isolated solitons - an expanding large-amplitude modulated solitary wavetrain propagating ahead of the bore. Using nonlinear modulation theory we construct an asymptotic solution describing the formation and evolution of this solitary wavetrain. Our analytical solution is supported by direct numerical simulations. The presented analysis can be extended to other systems describing the propagation of undular bores (dispersive shock waves) in weakly non-uniform environments.