What exactly was Lehi doing in Jerusalem? Weren’t most of the tribes of Israel scattered by now?
Yes, most were. But not quite all. For one thing, we know that the tribe of Judah stuck around beyond New Testament times. But Lehi was a descendant of Manasseh. “And Aminadi was a descendant of Nephi, who was the son of Lehi, who came out of the land of Jerusalem, who was a descendant of Manasseh, who was the son of Joseph who was sold into Egypt by the hands of his brethren.” (Alma 10:3)
The reason I bring this up is that according to the Old Testament, the descendants of Judah and Manasseh got Jerusalem as their Israelite inheritence…
And in Jerusalem dwelt of the children of Judah, and of the children of Benjamin, and of the children of Ephraim, and Manasseh;
1 Chronicles 9: 3
…which explains what a non-Judah descendent was doing in Jerusalem in 600 BC.