I have a seven month old kitten that likes to do that when I am cleaning litter boxes. She normally just uses me to get from the bed to the dresser so not a big deal. Occasionally she sticks around for a few seconds before moving on.
Then I have Greyson. He is somewhere in the neighbourhood of 15 pounds. He likes to do the same when I'm doing the boxes in their house. He does it because he likes to give me hugs. Yep, he will put his head down on my shoulder and rub. Then he flops his whole body down and lies there. The only way to get him off is to roll my shoulders back and forth so he feels slightly seasick.
I make sure I'm near something for him to jump on when I do that.
Try saying a sharp NO and clapping your hands when your cat does that. See if it helps.