Cats (and dogs too according to Ray from A Dog’s Life) occasionally (or often) race around insanely just before a major bowel movement. Perhaps it’s to “loosen it up” or “jiggle it down.”
No matter how you look at it, it’s crazy. All of our cats do it even the old ones. Up the stairs, down the stairs, around the room, up the walls, across the furniture (and you if you are sitting).
It never seems to make sense (especially to visitors) until they dart to the stairs for the litter box.
Then it’s grooming and off to nap. You don’t want them to cuddle with them at this time (or get a lick).