The system map always shows the heaviest stellar body at the top.
Or at least it used to. I've been through a few ternary systems (in deep space with no carriers about) where the star order displayed was
Presumably just the ones where the combined mass of B+C makes the B-C barycentre heavier than the A star. Could be a change in the recent update since I don't remember noticing it any other time.
In the case of the system map it looks like it has got very confused by having a non-star object barycentric with the primary star [1] (in Legacy, it's orbiting the A-(BC) barycentre) and that breaks everything.
[1] Elite Dangerous convention is that a top-level star can't be barycentric with anything other than a star, presumably to keep the Sol system displaying in a reasonably conventional fashion as the Sol-Jupiter barycentre is not within the surface of the sun. Or at least, that
was the convention...