It is only a question of perceived risk & minimizing the perceived amount of money that the company would have to pay, if an event happened.
The drug test only indicates whether the specific chemicals are in the body at that time. I've heard the rule of thumb of 30 days, but it is heavily dependent on usage rate, metabolic rate, hydration level, etc. If an individual fails a drug test, there is no direct correlation between single use, multiple use, or even when the drugs were used - only that the concentration is sufficient to fail the test.
A company minimizing the amounts of money they have to pay (even perceiving that they will pay) in the event of an incident will take the conservative approach. It is very easy to assume that failed drug test = person likely to use again, or worse, a person who recreationally breaks the law.
From the employer's perspective - there is an employee who has engaged in illicit activity, and there is the potential to do so again. What other laws would the applicant break, and is there an increased risk in the workplace (resulting in pay-outs by the employer)?
And it is not egregious - if you don't want to submit to a test - DON'T WORK THERE. Very simple.