Regarding immunological defence against pathogens, one of the many defences is that of the complement system. Here, the antibodies recognise and attach to a cell infected with antigens. Following which, complement proteins attach to the antibodies and produce the membrane attack complex, which causes the formation of pores in the cell membrane of the infected cell, causing it to then lyse. However, I was wondering, isn't this somewhat like necrosis where the cell contents just "spill out"? Since the cell is infected, then wouldn't the cell contents containing the pathogen affect neighbouring cells? Thanks!

That depends on kind of pathogen and stage of its pathogen cycle. The pathogen probably needs to complete some steps before it can lyse the cell, if you lyse it before that, the pathogen shouldn't survive.