Autoimmune diseases occur when immune cells improperly categorize some "self" cells as "non-self" and trigger immune response on them.
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.
Instead it's dependent on the (specific to the individual) set of genes controlling the major histocompatibility complex, and so is very much a "self" ("derived from my genes") versus "non-self" ("not derived from my genes") determination.
The immune systems primary function is housekeeping: killing cells that are still completely 'self', but are old, worn down or dysfunctional in some other way. Killing 'invaders' and cancers is minor in terms of the numbers of cells destroyed.
As your transplant example shows: something foreign can be found to be entirely 'healthy' by your immune system. So self vs. foreign is too narrow.
See also my comment to ubernostrum further downthread. There is no compelling reason to frame cancer or infectious disease as a conflict or invasion. Doing so is just as reasonable as framing housekeeping as a conflict with 'foreign dirt' or an invasion of 'the outside world into your house'.
People conceptualize their own illness in very different ways. An author I very much respect, Jenny Diski, died recently, and in her final series of essays about her life and her cancer (and impending death), she said at one point, “under no circumstances is anyone to say that I lost a battle with cancer, or that I bore it bravely. I am not fighting, losing, winning, or bearing.”