There can be a number of reasons for the cat doing so, but none of them are really indicative of a problem.
- Some cats prefer playing to cuddling, and will always try to play with whoever gives them attention.
- Some cats get playful when they're really happy, even if they're generally not that playful. One of our cats is not big on playing but a playful side emerges after petting her for a long time.
Maybe she was lying down out of sheer boredom. Your petting indicates that you're interacting with her, and if she would rather play with you than cuddle with you, she will start playing.
Should you stop that? Maybe. I don't really see the reason to. Simply respond genuinely:
- If you're happy to play with her, then play with her.
- If you're not interesting in playing, then don't and continue petting her.
- If she's that playful that she makes petting her impossible without playing, then simply stop petting her.
Over time, she will learn that you are not always available for playing.
For example, because they would wake us up when playing in the bedroom, we stopped playing with them in the bedroom. Only petting. In other parts of the house, both playing and petting happens. In a matter of days, they stopped trying to play with us (and sometimes even each other) in the bedroom. Because they recognized the pattern.
Be genuine and the cat will adjust itself to your behavior. Don't cater to the cat's whims and then possibly end up resenting them for having those whims.