Because there are obvious safety issues with crossing a road outside a crosswalk, whereas you'd be hard-pressed to come up with a similar rationale for carrying ±2 grams of pot.
It, again comes does to removing judgment and making clear lines. First, the premises of both laws: crossing the street can be done safely or unsafely; smoking pot by yourself is not harming anyone but providing pot for others could be a harm to others. Now, how to enforce them without making vague rules: lines painted where it's permitted; a mass measure to determine how much is more than for oneself.
Of course, there are times when one can cross safely outside the lines and there are times when one wants to smoke a lot more, but if we make laws to encourage one type of behavior it's better for those laws to be clear. Lines and numbers do that; that's why there's a number.
One can disagree with the number, but that's how limits work. Same goes for BAC or number of times you enter the country on a visa or amount of money you can carry across a border without declaring it or value of a gift you can give without it being taxable income or so many other things.