The spiritual aspect:
IMO the smoke monster is not "evil" but rather a polymorphic astral projecting entity that is apart of the Island and integral to it's goals...
"You'll be able to cut yourself free once you have the proper
motivation." -John Locke, Hearts and Minds
When you go to John Locke (character) philosophy, he often argued that for destiny to be fulfilled one needs: "proper motivation".
Sometimes in Philosophy and/or religion there are "gods or goddesses" that are in trickster roles, where they sometimes are playing an antagonist to spiritually move a person forward.
Even though LOST had an ensemble cast, it's really a father (Christian) and son (Jack) story, where the son is spiritually broken due to the abuse of his father's beliefs. It takes the course of the series for Jack to finally come to terms with the possibility that his father, for all of his missteps or misguidance, was still in part right about there being something greater than the self and there may be "fate" in the universe. He ultimately comes to terms with him through the experience of the Island in this lifetime.
So when the smoke monster chose to be Jack's father, that was one way the Island was trying to motivate Jack to save the Island, so that he could save himself, humanity, infinite lifetimes/time lines by "saving the Island", but it wasn't enough. John Locke had a similar viewpoint about fate, as Christian did, but because Jack had experienced so many explainable things through knowing John with John's beliefs being a kind of tether to his father, John's death tended to be a kind of double-whammy. This was then ideal for the smoke monster to assume Locke's identity, because the truth of something-else impersonating him would again prompt Jack to get mad and find a way to save the Island...
It should be noted that although the smoke monster often took on the appearance of those that have died with or without a body, it did at least once take on someone not yet dead, such as "taller ghost Walt" in Through the Looking Glass Pt.1, which furthers the idea that another older Walt had to of already existed for the smoke monster to be able to be that version of not yet aged Walt (It's true that the out of universe aspect Michael David Kelly had grown a lot, but it still works as an in-universe answer since there are other instances of things pointing to multiple time lines, despite it is never perfectly disclosed). In addition the real spirits of the dead, including Christian Sheppard also manifested and came to exist on the Island, which made things all the more confusing, but ultimately didn't matter since it was always about spiritually moving forward and the Island maintaining the fabric of space-time.