I’m not sure why the rule is not working but most motion sensor have a wait period before reporting changes.
Again, a little off topic but relevant: If motion changes to active, even if you left out of the room in less than five seconds, if your motion sensor has a 30 second wait period, it will show motion active for at least 30 seconds before reporting inactive. Some have longer wait periods like the Ecolink which only reports every 4 minutes. Some are 1 minute, some are 2, hardly any will be 5 seconds as this will kill the battery.
So, if the lights are coming on immediately, then the rule is not working. If they are coming on after the 5 seconds even if you are not in the room, it’s because it will continue reporting motion until the wait period has passed.