My youngest first did this at around 3 or 4 months. Are you sure yours has never done it before? I found with mine, nipping it in the bud has prevented it from escalating. Distraction immediately as she was about to, so that she never got into the habit, worked with her. As LoathsomeDrab says, it's not always sexual!
If he has only just started, then at 8 months I would assume it is hormonal. Castration may or may not help - once it's become habitual, it can be a difficult habit to break regardless.
Obviously, for your DDs sake, it is unnaceptable. As soon as he looks like he's about to hump, call him to you, have treats to hand and proceed with a few basic training moves for treats. This way, he won't associate humping with treats but rather, the giving to you of his attention.
Also work on teaching him the 'leave' command, for an immediate treat. Soon, you should be able to have him 'leave' your DD alone.
Either way, you will have to consistently catch him just prior to humping but soon, he should understand that more desirable behaviours attract more desirable results (treats!).