"Why is it illogical to argue that marijuana should be legal because alcohol is more harmful, yet legal?" Because chemotherapy is more harmful than both. But it should not be illegal, as it is currently our most efficient, non-invasive treatment for cancer.
"Is it not reasonable to expect the legal substances to be safer than the illegal ones?" No. Substances are (supposed to be, at least) controlled based on their potential for abuse verses their potential benefits. Example: Toluene. It's an industrial solvent. Some people use at as in inhalant. Prolonged use literally rots holes in the brain. It's not illegal, because a much larger majority of people use it to manufacture things like paints and rubber. If more of society used it to rot their brains than manufacture things, it probably would be illegal. In fact, there are cities and counties where it is more strictly regulated than most of the country, as result of epidemic abuse.
"Preventing potential harm to oneself/others is the basis for outlawing substances in the first place, right?" No. Criminalizing a substance altogether is the basis for eliminating access entirely. Regulating and labeling are the basis for "preventing potential harm to oneself/others."