מאיבי תחכמני מצותך is generally translated as “Thy commandments make me wiser than mine enemies”, and לעולם היא לי refers back to תורתך. I am always learning Torah, so your commandments make me wise.
But we know how the Mishna translates the next line:
The מִ־ means “from”, not “more than”. This is a common ambiguity in תנ״ך; when Avimelech complains about Isaac’s wealth, he says:
Is it “You are richer than we are” or “You became rich from us—it should be our wealth”? I would read all literary ambiguity as intentional. Both readings are valid. So too here, we could read this as “My enemies made me wise in Your commandments”. Learning from everyone means learning even from those who oppose us. The Kedushas Levi says we learn this from Noah:
The idea of מכל מלמדי השכלתי, that a חכם learns from everyone, is even more important to teachers:
The Tosfot Yom Tov sees a problem with a parallel mishna earlier in אבות:
There’s another possible reason that יהושוע בן פרחיה didn’t want to talk about students (I saw this in a Chabad commentary on Pirkei Avot). There’s an interesting censored paragraph in the Talmud:
(Despite the fact that it was censored for fear of the Church, the ישו here can’t be Jesus; “Alexander Jannaeus (also known as Alexander Jannai/Yannai)…was the second Hasmonean king of Judaea from 103 to 76 BC” [Wikipedia]).
But I would understand יהושוע בן פרחיה's statement as actually being about students, and what is means to say מתלמידי יותר מכולן. The only way to learn from from your students is to accept that they have something to say, that you don’t know everything. הוי דן את כל האדם לכף זכות means allowing that others may not be evil even if I disagree with them, and I need to have the humility to be able to say מאיבי תחכמני מצותך.