Immune-system resistance is especially difficult due to how immunity works.
First, I make 2 assumptions in my explanation:
- the pathogen isn't specially designed to dodge the immune system and it isn't able to hide dormant in cells
- the immune system is healthy and normal
When a pathogen is present, the immune system samples pieces of it (epitopes) and works on "randomly" putting together antibodies that bind to that epitope. Once a match is found, the qualifying antibody proliferates and is deployed in full force. Each copy of the matching antibody binds to the offending pathogen on contact with good probability - think of it as a microscopic football tackle. Cell-like pathogens (bacteria, fungi, and protozoa) thoroughly covered in antibodies can't consume nutrients, attack cells, and in extreme cases they can't excrete toxins because exocytosis proteins are blocked in antibodies. Viruses covered in antibodies have their surface structures blocked, thoroughly preventing binding to host cells.
The only reason why antibiotics are "easy" to gain resistance to by comparison is that they don't change on their own. The ones most vulnerable to resistance rely on tricking bacteria into eating them (endocytosis), which quickly selects for bacteria that work around the vulnerable protein channel. In other cases, bacteria develop something that inactivates antibiotics.
There has recently been work on antibiotics that force their way into bacterial cells, effectively punching large holes in the membrane. These would be difficult to develop resistance to, especially if they operate via electrical potential or grab onto a wide variety of bacterial epitopes.
Additionally, bacteria would be in a lot of trouble if humans developed antibiotic-generator implants that work as a secondary immune system. Consider a technology that scans for pathogenic bacteria, builds computerized 3D models of them, and then uses a biochemical 3D printer chip to construct custom antibiotics after preliminary safety checks to verify that the custom antibiotic in question wouldn't have dangerous side effects.