This is addressed by R. David Halevi Segal in his supercommentary on the spot:
לכאורה קשה שיש איסור בלשון זה שהרי ארז"ל שאסור לומר הלכה זו נאה הלכה זו אינה נאה דא”ל דדוקא תרווייהו יש איסור לומר ז”א דהא הלכה זו אינה נאה לחוד יש איסור אלא ע”כ דה”ק כשם שאסור לומר הלכה זו אינה נאה כך אסור לומר הלכה זו נאה דמתוך זה משמע שהלכות אחרות אינם נאים ח”ו וא”כ למה אמר רש”י פרשה זו כו’ וי”ל דגם כאן יש מיעוט דבשאר מקומות יש ב’ דרכים האחד לפי פשוטו והשני לפי המדרש אבל כאן אין כאן אלא דרך אחד דהמדרש הוא פשוטו שאין כאן פשוטו רק המדרש הוא יפה נדרש אפי’ לפי פשוטו דאין שום פירוש על ויקח מה לקח לפי פשוטו
It is seemingly difficult since there is a prohibition of this language, for the Sages said that it is forbidden to say “this law is nice [but] this [other] law is not nice”. We can’t suggest that it’s only both [parts of the statement] that is forbidden to say, because the statement “this law is not nice” is forbidden on its own. Rather it must mean that just as it is forbidden to say “this law is not nice” [on its own] it is forbidden to say “this law is nice” [on its own], since within this it implies that other laws are not nice, heaven forfend. And if so, why did Rashi say “this section [has been nicely expounded]?
We could say that here too there is a limitation [implied]. For in other places there are two approaches: one is according to the straightforward meaning, and the second is according to the Midrash. But here there is only one approach, for the Midrash is the straightforward meaning since there is no straightforward meaning. Rather, the Midrash is nicely expounded even according to the straightforward meaning, since there is no explanation for “And he took” that explains what he took according to the straightforward meaning.
In other words, since this verse says that Korach took but it doesn’t say what he took, the only way to make sense out of the verse is via the Midrash which becomes the straightforward meaning of the verse. That is what Rashi is alluding to by saying that specifically here the Midrash expounded nicely.