Motion-based counter-driven automation

I agree with @Ryan780 that keeping an accurate count isn't going to be easy. However, you can't find out for sure if you don't try.

As @mike.maxwell mentions, Motion Lighting will do the first bit. You can use RM to keep count with a virtual dimmer. Here's an example use case

I'm not aware of any PIR motion sensors that reset as quick as you're looking for, but you can do this mod to Xiaomi motion sensors and they will reset in 5 seconds. I soldered, but several people have just used a 2B Pencil and said it works. You can also use a conductive pen.