I confirm that the issue was raised incorrectly, we don’t take into account .Any().
I created a ticket to track this issue.
Know that it will be part of the improvement of S4158 in this ticket, especially about:
Learn from well-known (extension-) methods like list.Any()
Checking if the array is not empty with .Any() using .FirstOrDefault() is not necessary since you already know that .FirstOrDefault() will never return null (or default), as you pointed out.
Because of the .FirstOrDefault(), we assume that itemMain can be null; thus, we raise S2259.
Then it is relevant to update your snippet to this (assuming array is of type Array):
TreeItem itemMain = array; // Using .First() would raise S6608
itemMain.Selected = SetSelectedFolder(itemMain);