Once vilified for squeezing workers and small retailers, Walmart has rewritten its playbook—investing in people, embracing AI with restraint and challenging the logic of cost-cutting automation. Its share price had fallen when it first unveiled its new strategy. Today, it’s paying off in spades.