If your line is on pixel-perfect coordinates and you set the line either to outer or inner strokes, it should look perfect. I won’t say it “definitely will” because people sometimes get strange cases, but that’s how I do it daily.
It’s basically because the line shares the same behavior of other shapes, like rectangles. If you draw a normal box, the vector is drawn “between” pixels, so that if you set the stroke to either 1px inner or outer, it will look pixel perfect.
The developers chose to draw single lines with center stroke so you don’t have to think whether to draw lines 1 pixel closer or further from other shapes, which could also be a problem when arranging shapes at equal distance between each other; you just draw it exactly in the middle pixel, and it will look correct. It’s a compromise, and I don’t really like it much (like you, I prefer all my shape coordinates to be pixel perfect), but there is not really a “right” way to do it; whatever way you choose there will be drawbacks.