As you mentioned, the verse says in Deut. 12:
כט כִּי-יַכְרִית יְהוָה אֱלֹהֶיךָ אֶת-הַגּוֹיִם, אֲשֶׁר אַתָּה בָא-שָׁמָּה לָרֶשֶׁת אוֹתָם--מִפָּנֶיךָ; וְיָרַשְׁתָּ אֹתָם, וְיָשַׁבְתָּ בְּאַרְצָם. 29
When/because/definitely Hashem your God shall cut off the nations from before you, where you go in to dispossess them, and you shall dispossess them, and dwell in their land;
ל הִשָּׁמֶר לְךָ, פֶּן-תִּנָּקֵשׁ אַחֲרֵיהֶם, אַחֲרֵי, הִשָּׁמְדָם מִפָּנֶיךָ; וּפֶן-תִּדְרֹשׁ לֵאלֹהֵיהֶם לֵאמֹר, אֵיכָה יַעַבְדוּ הַגּוֹיִם הָאֵלֶּה אֶת-אֱלֹהֵיהֶם, וְאֶעֱשֶׂה-כֵּן, גַּם-אָנִי.
30 take heed to yourself that your be not ensnared to follow them, after that they are destroyed from before thee; and that you inquire not after their gods, saying: 'How used these nations to serve their gods? even so will I do likewise.'
לא לֹא-תַעֲשֶׂה כֵן, לַיהוָה אֱלֹהֶיךָ: כִּי כָל-תּוֹעֲבַת יְהוָה אֲשֶׁר שָׂנֵא, עָשׂוּ לֵאלֹהֵיהֶם--כִּי גַם אֶת-בְּנֵיהֶם וְאֶת-בְּנֹתֵיהֶם, יִשְׂרְפוּ בָאֵשׁ לֵאלֹהֵיהֶם.
31 You shalt not do so unto Hashem your God; for every abomination to the LORD, which He hateth, have they done unto their gods; for even their sons and their daughters do they burn in the fire to their gods.
Among other verses.
Now, beyond straight up idolatry, even works of philosophy and even rationalistic philosophical approaches to the Torah that have entered our Rabbinic literature for whatever reason, are a severe, severe prohibition - so all the more so the ways of heresy God forbid - except only certain extraordinary Tzaddikim needed to descend into them for specific reasons on "special missions" to repair "souls" and extricate holiness, and repair and redeem things - per Likutei Moharan #64.
https://www.sefaria.org/Likutei_Etzot%2C_Philosophy_and_Secular_Wisdom.9?lang=bi&with=all&lang2=he
ט. אִסּוּר גָּדוֹל לְעַיֵּן בְּסִפְרֵי הַמְחַקְּרִים. כִּי יֵשׁ כַּמָּה קֻשְׁיוֹת שֶׁנִּמְשָׁכִין מִבְּחִינַת חָלָל הַפָּנוּי שֶׁאִי אֶפְשָׁר לִמְצֹא עֲלֵיהֶם תֵּרוּץ בְּשׁוּם אֹפֶן, רַק לֶעָתִיד לָבוֹא יִתְגַּלֶּה הַתֵּרוּץ, אֲבָל בְּזֶה הָעוֹלָם אִי אֶפְשָׁר לְיַשְּׁבָם בְּשׁוּם שֵׂכֶל. וּמִי שֶׁמְּעַיֵּן בְּאֵלּוּ הַחָכְמוֹת הַנִּמְשָׁכִין מִשָּׁם, יִהְיֶה נִשְׁקָע וְנֶאֱבָד שָׁם לְעוֹלָם, כִּי עָלֶיהָ נֶאֱמַר: "כָּל בָּאֶיהָ לֹא יְשׁוּבוּן". כִּי אִי אֶפְשָׁר לִמְצֹא בָּהֶם אֶת הַשֵּׁם יִתְבָּרַךְ וּלְהָשִׁיב עַל הַקֻּשְׁיוֹת וְהַמְּבוּכוֹת שֶׁבָּהֶם בְּשׁוּם שֵׂכֶל. רַק יִשְׂרָאֵל, עַל־יְדֵי אֱמוּנָה עוֹבְרִים עַל כָּל הַחָכְמוֹת וְעַל כָּל הַמְּבוּכוֹת שֶׁבָּעוֹלָם. כִּי הֵם מַאֲמִינִים בְּהַשֵּׁם יִתְבָּרַךְ וּבְתוֹרָתוֹ הַקְּדוֹשָׁה בְּלִי שׁוּם חֲקִירָה וְחָכְמָה, רַק בֶּאֱמוּנָה שְׁלֵמָה. וְעַל שֵׁם זֶה נִקְרָאִים יִשְׂרָאֵל "עִבְרִים", עַל שֶׁעַל־יְדֵי אֱמוּנָתָם הֵם עוֹבְרִים וְעוֹלִים עַל כָּל מִינֵי חָכְמוֹת וַחֲקִירוֹת. כִּי אֵינָם צְרִיכִים לַחֲקֹר אַחַר הָאֱמֶת כְּלָל, כִּי הֵם יוֹדְעִים הָאֱמֶת לַאֲמִתּוֹ עַל־יְדֵי אֱמוּנָתָם הַשְּׁלֵמָה, שֶׁמַּאֲמִינִים בְּהָאֱמֶת כְּפִי מַה שֶּׁקִּבְּלוּ מֵאֲבוֹתֵינוּ וְרַבּוֹתֵינוּ זַ"ל. וְעַל־יְדֵי זֶה הֵם עוֹבְרִים וְעוֹלִים עַל כָּל הַחָכְמוֹת כֻּלָּם: (לק"א סי' ס"ד אות ב')
It is forbidden to delve into philosophical works. There are certain questions which stem from the chalal hapanui, “the empty void,” to which it is impossible to find any answer. In time to come the answers will be revealed. But in this world it is impossible to put these questions to rest merely with thought and ingenuity. Whole philosophical systems have been built up around them. Anyone who delves into them will be sunk in them and lost eternally, as it is written: “None that go unto her return” (Proverbs 2:19). God is not to be found in these philosophies. Through intelligence alone it will never be possible to solve the intellectual tangles they contain. The Jewish people, with its faith in God, is beyond all these philosophies and their complications. Israel believes in God and His Holy Torah without needing philosophical justifications. They have pure faith. The Hebrew word for “beyond” is עבר, e-ver, and the Jews are called עברים, Ivrim — Hebrews — precisely because they are beyond all this speculation. With a faith which transcends philosophy we do not need to speculate about the truth. We know it. We have received it from our fathers, of blessed memory (Likutei Moharan 64:2).
י. וְדַע, שֶׁיֵּשׁ צַדִּיקִים גְּדוֹלִים שֶׁהֵם צְרִיכִין דַּוְקָא לְעַיֵּן בְּאֵלּוּ הַחָכְמוֹת, כִּי עַל יְדֵי עִיּוּנָם בָּהֶם הֵם מַעֲלִין וּמוֹצִיאִין מֵהֶם כַּמָּה נְשָׁמוֹת שֶׁנָּפְלוּ וְנִשְׁקְעוּ בָּהֶם. וְעַל־כֵּן אַל תָּבִיא לְךָ רְאָיָה מִמַּה שֶּׁמָּצִינוּ כַּמָּה גְּדוֹלֵי הַקַּדְמוֹנִים שֶׁעָסְקוּ בְּאֵלּוּ הַחָכְמוֹת, כִּי הָיוּ מֻכְרָחִים לָזֶה כַּנַּ"ל. וּלְגֹדֶל קְדֻשָּׁתָם הָעֲצוּמָה הֶעֱלוּ נְשָׁמוֹת שֶׁנָּפְלוּ בָּהֶם, כַּנַּ"ל. אֲבָל אֲנָשִׁים שֶׁאֵינָם גְּדוֹלִים בְּצִדְקוּת כָּל כָּךְ, מִכָּל שֶׁכֵּן אֲנָשִׁים פְּשׁוּטִים, בִּפְרָט בַּדּוֹרוֹת הַלָּלוּ, חָלִילָה לְהִסְתַּכֵּל וְלִכְנֹס בָּהֶם, כִּי יִהְיֶה נִשְׁקָע וְנֶאֱבָד שָׁם לְעוֹלָם רַחֲמָנָא לִצְלָן: (שם אות ג')
Certain of the great Tzaddikim were obliged to go into these philosophies in order to extricate and elevate the souls which have fallen and become sunk in them. You cannot argue that it is permissible for others to enter them on the grounds that many of the great scholars of the past were involved. In their case it was an obligation. And through the great sanctity they possessed, they had the power to release the souls which were trapped. But people who are not on a comparable level of sanctity, and needless to add, the ordinary people of our own age, should never enter these realms and risk being eternally lost (Ibid. 3).
יא. עַל־יְדֵי הַנִּגּוּן שֶׁל הַצַּדִּיק הַגָּדוֹל הָאֲמִתִּי, הוּא מַעֲלֶה הַנְּשָׁמוֹת שֶׁנָּפְלוּ לָאֶפִּיקוֹרְסוּת הַנַּ"ל שֶׁאֵין עָלֶיהָ תְּשׁוּבָה: (שם אות ה')
The song of the true Tzaddik has the power to draw up the souls that have fallen into this form of atheism, from which there is otherwise no return (Ibid. 5).
See also Chayey Moharan #407 ff.
https://en.wikisource.org/wiki/Translation:Chayey_Moharan#%5B%23407-425%5D_Keeping_Far_Away_from_Chaqirot_%28philosophy%3B_rationalism%3B_undermining_or_questioning_the_tenets_of_faith%29_and_Staying_Strong_in_Emunah_%28Faith%29
#407
407
About the philosophical books he told us a great deal, many times. And he utterly, utterly forbade us to even look at them at all, God forbid. He put extraordinary stress on the severity of this prohibition, because they very much confuse one's religious views with alien views that do not at all agree at all with the views of our Holy Torah. They [the authors of these philosophical books] also do not believe in demons whereas all the words of the Talmudic Sages say the opposite. Especially now that we've been privileged to [the revelation of] the Zohar, the books of the Arizal and the Baal Shem Tov of blessed memory and so forth, which are all founded on Ruach Hakodesh and greatly inspire a person in truly serving His Blessedness.
...