I don’t know about every cat I’ve ever had, but my youngest currently? I think there’s two reasons she does it: 1. To announce her presence on top of me and make it known she is pleased her bed is in bed and 2. To make the spot more comfortable, like how we fluff our pillows or smooth out our bedspreads or whatever. She’s making the spot hers.
I mean it is an action that can also deposit their scent, but uh, in my experience my cats have never respected that marker if they don’t want to.