The Word of Wisdom, which outlines the health guidelines of not drinking alcohol and using tobacco, as well as eating less meat, eating more grains; was originally just as the name suggests, words of wisdom.
Joseph Smith drank wine, used tobacco, and drank coffee up to his death.
It wasn’t until the early 20th century when it started to be treated as a commandment. This is around the time when they started codifying a lot of doctrine, stopped practicing polygamy, and started to function more like a mainstream religion and less like a cult.
Source: raised Mormon, went on mission, took religion classes at BYU-Provo on church history.