Legitimate only means that the :rules: were followed and nothing more. It does not mean that the rules or the system they reside in are just.
Winning an election on one manifesto, being chosen by 100k members, and then ripping the manifesto up and trying to implement a set of completely different policies would strike most, I think, as not 100% legitimate even if it's legal.
And just to add that she campaigned with members on ripping up the manifesto.
https://www.britannica.com/topic/legitimacy
While I agree with you that it would be incorrect to baldly dismiss Truss' premiership as illegitimate, I feel that uniqueuid's comment was using the term according to the above usage, suggesting, perhaps, that the law of the land is anachronistic, or less than optimal according to democratic principles.