The interaction between multiple pathogens spreading on networks connecting a given set of nodes presents an ongoing theoretical challenge. Here, we aim to understand such interactions by studying bond percolation of two different processes on overlay networks of arbitrary joint degree distribution. We find that an outbreak of a first pathogen providing immunity to another one spreading subsequently on a second network connecting the same set of nodes does so most effectively if the degrees on the two networks are positively correlated. In that case, the protection is stronger the more heterogeneous the degree distributions of the two networks are. If, on the other hand, the degrees are uncorrelated or negatively correlated, increasing heterogeneity reduces the potential of the first process to prevent the second one from reaching epidemic proportions. We generalize these results to cases where the edges of the two networks overlap to arbitrary amount, or where the immunity granted is only partial. If both processes grant immunity to each other, we find a wide range of possible situations of coexistence or mutual exclusion, depending on the joint degree distribution of the underlying networks and the amount of immunity granted mutually. These results generalize the concept of a coexistence threshold and illustrate the impact of large-scale network structure on the interaction between multiple spreading agents.