Now, let's look at the context of Vayikra 18:5, with the key phrase from which Yoma 85b learns this law boldfaced:
אֶת־מִשְׁפָּטַ֧י תַּעֲשׂ֛וּ וְאֶת־חֻקֹּתַ֥י תִּשְׁמְר֖וּ לָלֶ֣כֶת בָּהֶ֑ם אֲנִ֖י יְהוָ֥ה אֱלֹהֵיכֶֽם׃ וּשְׁמַרְתֶּ֤ם אֶת־חֻקֹּתַי֙ וְאֶת־מִשְׁפָּטַ֔י אֲשֶׁ֨ר יַעֲשֶׂ֥ה אֹתָ֛ם הָאָדָ֖ם וָחַ֣י בָּהֶ֑ם אֲנִ֖י יְהוָֽה׃ אִ֥ישׁ אִישׁ֙ אֶל־כָּל־שְׁאֵ֣ר בְּשָׂר֔וֹ לֹ֥א תִקְרְב֖וּ לְגַלּ֣וֹת עֶרְוָ֑ה אֲנִ֖י יְהוָֽה׃ [...]
Guard my laws and ordinances that a man will do them and live in them, I am Hashem. No man should draw close to any close relative to expose nakedness; I am Hashem. [...]
Verses 6-30 continue on the theme of immorality, which is one of the exceptions to the rule that one should violate mitzvos rather than die!
Hashem could have taught this halacha anywhere; why did He teach it in the context of immorality, one of its exceptions?