"Indirect object" is a somewhat fuzzy category (inherent argument of a verb that's introduced, in at least its nominal form, by a preposition) that covers a rather large number of phrases not always united in their morphosyntactic behaviour, and that seems to be what's causing your issue here.
Lui/leur is the pronoun corresponding to some indirect objects, but not all of them.
More precisely, lui/leur, as a direct descendant of the dative case in Latin, roughly continues its uses in Modern French, that is to say:
- it refers to the recipient of an action (je lui parle, je leur donne une pomme, je leur envoie un SMS)
- it refers to the person affected physically or mentally by an action, in good or bad (il lui a mordu l'épaule, je leur ai préparé un bon petit plat, ça lui arrive)
- it's used for a set of less common uses in specific constructions, including possession (c'est à lui), obligation (c'est à moi de le faire, je lui ai ordonné/demandé de le faire) and the so called ethical dative (almost never used in the third person, but see je vais me lui parler, where me is a supplementary ethical dative pronoun)
- it's the default third argument of a verb. Most other prepositions are semantically motivated, but arguments marked by the preposition à and pronominalised by lui/leur can appear totally absent of reason when the subject and direct object arguments of a verb are already filled. You can this most easily in the causative construction where a displaced subject can either be marked semantically as an agent by the preposition par or fill one of the empty default object slots of the verb: Marc lit -> je faire lire Marc/à Marc/par Marc.
In all of those uses, the dative pronouns correspond to noun phrases marked by the preposition à. In one of those uses, it overlaps with the (semantically motivated) use of the preposition pour to mark beneficiaries of an action:
Je prépare un bon petit plat à mes enfants > je leur prépare un bon petit plat
Je prépare un bon petit plat pour mes enfants > je prépare un bon petit plat pour eux
But as you can see from the correspondence above, this semantic overlap doesn't mean that there is a syntactic link between "je leur prépare un plat" and "je prépare un plat pour mes enfants". Presenting it as the pronoun leur replacing the noun phrase "pour mes enfants" is simply wrong. They're two different sentences that mean almost the same thing.
When pour isn't used to mark the beneficiary of purely good willed action, this correspondence completely breaks down:
"Je travaille pour Mohammed" -> "Je travaille pour lui" but never *"Je lui travaille"
"J'ai voté pour Hélène" -> "J'ai voté pour elle" but never "je lui ai voté"
However, I would be remiss if I didn't mention the one case where there truly is a direct correspondence between indirect objects not marked by à and dative pronouns. A limited set of verbs whose indirect object refers to human beings strongly (and generally negatively) affected by the action of the verb can be pronominalised by lui/leur (or their first and second person counterparts):
il court après ma sœur -> il court après elle OR il lui court après
Il crie souvent sur ses enfants -> il crie souvent sur eux OR il leur crie souvent dessus
In neither case can you say "il court après à ma sœur" or "il crie à ses enfants souvent" without wholly changing the meaning of the sentence. There is no set of two semantically overlapping constructions here, but indeed a novel usage of the dative pronouns.
Note that this use is further restricted to the so-called "orphan prepositions", i.e. those who can be used alone (in their usual form or a strong adverbial one like dans-> dedans).
These two conditions eliminate the possibility of using dative pronouns with all of the sentences in the question, but "je me bats contre lui" since those verbs are all fairly positive and don't strongly affect the direct object. Furthermore, envers and en can't be orphaned. In fact, most occurences of this construction involve the preposition sur/dessus, that often marks the target of a violent action (crier dessus, taper dessus, tirer dessus, etc).
A third constraint is that this is only possible if the verb doesn't already have a pronoun that fills the same slot in the template of the French verb. In other word, because se and lui can't cooccur, this makes sentences such as "il se bat avec lui" or "elle s'enerve sur lui" impossible to turn into *"il se lui bats avec" or *"elle se lui énerve dessus", despite fitting the semantic requirement and using prepositions that can be orphaned (indeed, you can instead say "il se bat avec" and "elle s'enerve dessus"). This eliminates the possibility of this construction to be used with "Je me bats contre lui", since me and lui cannot be used together on the same verb (outside of the aforementioned use of the ethical dative)