Part of our pre-flight duties is to confirm that the smoke detectors are in proper working order. I'm sure the crew did that. That being done successfully doesn't stop a passenger during flight from disarming or cloaking the detector. If the alarm has been deactivated or isolated then smokers blithly go at it with no worries of flashing lights, buzzing or bells going off.
You're right though. As soon as that lav door is opened the smell and smoke billows out into the cabin. Only if a crew member is coincidently on the other side of that door when it opens can the culprit be caught red-handed. Even in that scenario doubt can be cast because we have to physically catch them with a lit cigarette in their hand before we can legally make an accusation and pursue the issue.