Some dogs use it as a self-soothing behavior to cope with high-stress situations.
While "humping" is often associated with sexual behavior in various contexts, it is frequently discussed in veterinary articles regarding how dogs behave as they mature. matures humping
For young dogs, it is often a form of exploration and play rather than a sexual act. Some dogs use it as a self-soothing behavior