Reish Lakish said: One who expelled phlegm in front of his master has acted in a disrespectful manner and is liable for the punishment of death at the hand of Heaven, as it is stated: “All they who hate Me love death” (Proverbs 8:36). Do not read it as: “They who hate [mesanai] Me”; rather, read it as: “Those who make themselves hateful [masniai] to Me,” i.e., those who make themselves hateful by such a discharge
אָמַר רֵישׁ לָקִישׁ: כִּיַּח בִּפְנֵי רַבּוֹ חַיָּיב מִיתָה, שֶׁנֶּאֱמַר ״כׇּל מְשַׂנְאַי אָהֲבוּ מָוֶת״ — אַל תִּקְרֵי ״לִמְשַׂנְאַי״, אֶלָּא ״לְמַשְׂנִיאַי״.
How do we understand that such a severe punishment such as death can come for a violation like this? And, in general we find situations in the Gemara where it mentions one is liable for death when committing what seems to be relatively minor moral lapses. Ben Yehoyada tells us that it merely means that should it lead to Chillul Hashem or some other spiritual catastrophe, it may lead to liability of death. Similar to judicial warnings such as maximum penalty 5 years imprisonment. The maximum is not the minimum.
בן יהוידע שבת קיד, א
כָּל תַּלְמִיד חָכָם שֶׁנִּמְצָא רְבָב עַל בְּגָדָיו, חַיָּב מִיתָה. נקיט 'חַיָּב מִיתָה' על צד ההפלגה, כמה שאמר דוד המלך ע"ה (שמואל ב' יב, ה) חַי הֳ' כִּי בֶן מָוֶת הָאִישׁ הָעֹשֶׂה זֹאת, או הכונה רצונו לומר אפשר שיבא לידי חיוב מיתה אם יזדמן שיצא חלול השם הרבה מדבר זה, ואם כן החיוב הוא על חלול השם דכפרה שלו תלויה במיתה, כמו שנאמר (ישעיהו כב, יד) אִם יְכֻפַּר הֶעָוֹן הַזֶּה לָכֶם עַד תְּמֻתוּן.
Another answer to this can come by looking at the pashut pshat of the verse:
משלי ח:לו
But he who misses me destroys himself; All who hate me love death.”
כָּל־מְ֝שַׂנְאַ֗י אָ֣הֲבוּ מָֽוֶת
which means to say not those who act hatefully but rather those who hate "me", and Hashen Or The Torah Is Talking. Explains the Ralbag:
וחוטאי חומס נפשו. ואשר חוטא לי שלא ילך במוסרי להתישר להשגתי הוא עושק השלימות מנפשו וכל מי שישנא אותי וירחיקני הוא אוהב המות וההפסד המוחלט כי אליו דרכו לפי שמי שישנא התבונה ישנא גם כן החכמה וזה בלתי צריך אל באור:
In other words, the wisdom of the Torah or attachment to G-d is a source of life. Someone who cuts him or herself off from that will lose life. This does not need to be understood strictly literally. A person can suffer many small death and loss of time, loss of priority, loss of relationships, and loss of fulfillment. Every moment of life is life, and every moment not lift is death. Yes, ultimately, if one continuously ignores wisdom and does not stay attached to G-d, perhaps they will eventually suffer actual death as well.
for Video Shiur click here to listen: Psychology of the DAF Eruvin 99