Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Our cells have many, many receptors and molecular markers on their membranes. One of the ways in which the immune system does its job is by detecting infected cells which are presenting many viral molecular markers. This is a feature and not a bug, since it helps stem the infection by reducing the number of virus-producing cells.
You may have heard of NK (natural killer) immune cells. The NK decides which cells to kill by identifying which ones are exhibiting many molecular markers of stress, which gives it an important role in the body's immune response to cancerous cells, for example. So there is a balance of healthy markers and unhealthy markers that the immune system is measuring, and if it tips towards unhealthy, the distressed cell is no longer recognized as self and is eliminated by the immune system.
Auto-immune diseases are when this system is disregulated in some way, and the immune system attacks cells which would normally be deemed as healthy parts of the self.