Describing the behavior of immune cells as categorizing cells in 'self' and 'non-self' is itself an example of engaging in metaphor. It's an example of anthropomorphising the behavior of cells.
You can just as easily describe the behavior of immune cells as categorizing cells into 'healthy' and 'unhealthy' and killing the 'unhealthy' cells. Suddenly the disease is not about internal conflict, but about internal hygiene. And when the immune system kills 'foreign' cells, it's not because they are foreign, but because they are found to be 'unhealthy': deviating too much from what it considers 'healthy'.
This is a simpler explanation. Apply Occam's razor: the immune system does not care about whether something is 'foreign': that's a more complex, and more precise, judgement than is needed to determine whether something needs to be killed. The broader category of 'unhealthy', deviating from the template/norm, is sufficient and that is the only thing the immune system needs to determine.