The title of the question asks: "When did math start to be a hated subject in schools and universities?".
The literal meaning is "When did the subject of math start to be hated by students in schools and universities?". Notice it says schools and universities.
So what were the first and/or oldest universities?
Wikipedia's list of oldest universities in operation discusses the criteria to be counted as a university in teh list.
This article contains a list of the oldest existing universities in continuous operation in the world. Inclusion in this list is determined by the date at which the educational institute first met the traditional definition of a university used by academic historians[Note 1][specify] although it may have existed as a different kind of institution before that time.1 This definition limits the term "university" to institutions with distinctive structural and legal features that developed in Europe, and which make the university form different from other institutions of higher learning in the pre-modern world, even though these may sometimes now be referred to popularly as universities. Thus, to be included in the list below, the university must have been founded before 1500 in Europe or be the oldest university derived from the medieval European model in a country or region. It must also be still in operation, with institutional continuity retained throughout its history. So some early universities, most notably the University of Paris (founded around the beginning of the thirteenth century[2]), which was abolished by the Revolution in 1793,[3] are excluded. Some institutions re-emerge, but with new foundations, such as the modern University of Paris, which came into existence in 1896 after the Louis Liard law disbanded Napoleon's University of France system.
[https://en.wikipedia.org/wiki/List_of_oldest_universities_in_continuous_operation][4]
It lists as the oldest university still operating, the University of Bologna,in Bologna in the Kingdom of Italy in the Holy Roman Empire, founded about 1180 to 1190.
The University of Naples Frederico II was founded in 1224 by the KIng of Sicily, Emperor of the Romans Frederick II, claims to be the oldest public university in the World, founded by a head of government.
The list says:
Ancient higher-learning institutions, such as those of ancient Greece, ancient Persia, ancient Rome, Byzantium, ancient China, ancient India and the Islamic world, are not included in this list owing to their cultural, historical, structural and legal differences from the medieval European university from which the modern university evolved.[Note 2][Note 3][10]
This list https://www.topuniversities.com/blog/10-oldest-universities-world suggests a sort of older university, Al-Azhar University in Cairo:
Despite not gaining university status until 1961, Al-Azhar University deserves a mention in this list as it was originally established as early as 970 AD in Cairo, Egypt. Originally a ‘madrasa’, teaching students from primary to tertiary level, Al-Azhar University was first known as a center of Islamic learning but has since developed a modern curriculum of secular subjects, ensuring its survival.
This list [https://www.mastersavenue.com/articles-guides/good-to-know/the-10-oldest-universities-in-the-world][2] describes several universities as being older than the Wikipedi lists indicates.
It dates the University of Paris to 1160, the University of Salamanca to 1134, teh Universit of Oxford to 1096, the University of Bologna to 1088, Al-Azhar Unviversity in Cairo, founded in 970, and the University of Al Quaraouiyine, Fez, Morocco founded in 859 by a woman, Fatima al-Fihri.
According to the Guinness World Records site:
The oldest existing, and continually operating educational institution in the world is the University of Karueein, founded in 859 AD in Fez, Morocco. The University of Bologna, Italy, was founded in 1088 and is the oldest one in Europe.
[https://www.guinnessworldrecords.com/world-records/oldest-university][3]
And Karueein is a different spelling of Al-Quaraouiyine.
I note that a sort of unviversity was founed in the eastern Roman Empire at about the same time as Al-Quaraouiyine or Karueein:
With improving stability in the 9th century came measures to improve the quality of higher education. In 863 chairs of grammar, rhetoric, and philosophy (which included mathematics, astronomy, and music) were founded and given a permanent location in the imperial palace. These chairs continued to receive official state support for the next century and a half, after which the Church assumed the leading role in providing higher education. During the 12th century the Patriarchal School was the leading center of education which included men of letters such as Theodore Prodromos and Eustathius of Thessalonica.
[https://en.wikipedia.org/wiki/Byzantine_university][5]
The University of Constantinople, founded as an institution of higher learning in 425, educated graduates to take on posts of authority in the imperial service or within the Church.[39] It was reorganized as a corporation of students in 849 by the regent Bardas of emperor Michael III, is considered by some to be the earliest institution of higher learning with some of the characteristics we associate today with a university (research and teaching, auto-administration, academic independence, et cetera). If a university is defined as "an institution of higher learning" then it is preceded by several others, including the Academy that it was founded to compete with and eventually replaced. If the original meaning of the word is considered "a corporation of students" then this could be the first example of such an institution. The Preslav Literary School and Ohrid Literary School were the two major literary schools of the First Bulgarian Empire.
[https://en.wikipedia.org/wiki/Ancient_higher-learning_institutions#Christian_Europe][5]
The Imperial University of Constantinople, sometimes known as the University of the Palace Hall of Magnaura (Greek: Πανδιδακτήριον τῆς Μαγναύρας), was an Eastern Roman educational institution that could trace its corporate origins to 425 AD, when the emperor Theodosius II founded the Pandidakterion (Medieval Greek: Πανδιδακτήριον).1
https://en.wikipedia.org/wiki/University_of_Constantinople
Ancient institutions that provided frameworks for scholarly activities in Asia and Africa date back centuries before the European medieval universities. These included Buddhist monasteries like the Nalanda in India (427 AD – 1197 AD) and imperial academies in East Asia such as the Taixue in China (circa 202 BC–220 AD) and the Daigaku-ryō in Japan (671 AD).
[https://research.com/universities-colleges/oldest-university-in-the-world#:~:text=The%20University%20of%20Al%2DKaraouine,Guinness%20World%20Records%2C%20n.d.).][2]
Daigaku-ryō (大学寮) was the former Imperial university of Japan, founded at the end of the 7th century.1 The Daigaku-ryō predates the Heian period, continuing in various forms through the early Meiji period. The director of the Daigaku-ryō was called the Daigaku-no-kami.[2]
[https://en.wikipedia.org/wiki/Daigaku-ry%C5%8D][3]
Taixue (Tai-shueh; simplified Chinese: 太学; traditional Chinese: 太學; lit. 'Greatest Study or Learning'), or sometimes called the "Imperial Academy", "Imperial School", "Imperial University"[1][2][3][4] or "Imperial Central University", was the highest rank of educational establishment in Ancient China created during the Han dynasty. The Sui dynasty instituted major reforms, giving the imperial academy a greater administrative role and renaming it the Guozijian (國子監).[5] As the Guozijian, the institution was maintained by successive dynasties until it was finally abolished in 1905 near the end of the Qing dynasty.
[https://en.wikipedia.org/wiki/Taixue][4]
Nalanda (Nālandā, pronounced [naːlən̪d̪aː]) was a renowned mahavihara (Buddhist monastic university) in ancient Magadha (modern-day Bihar), India.[5][6] Considered by historians to be the world's first residential university[7] and among the greatest centers of learning in the ancient world, it was located near the city of Rajagriha (now Rajgir) and about 90 kilometres (56 mi) southeast of Pataliputra (now Patna). Operating from 427 until 1197 CE,[8][9] Nalanda played a vital role in promoting the patronage of arts and academics during the 5th and 6th century CE, a period that has since been described as the "Golden Age of India" by scholars.[10]
So if you want to be conservative you can say there were no universities for students to hate or fear math in until about 1190, which if you want to use looser defination of a university, there might have been universities centuries or millennia earlier where students might have dreated math courses.
I note that some of the early university equivlanents were for members of high ranking families, while other would have taken the most gifted students. I presume that many of the most gifted students in early university like schools might have had no fear of math courses at all, unlike many ordinary students.
Anyway, math courses were only feared and hated by students in ordinary schools until the first universities were founded.
1: https://www.topuniversities.com/blog/10-oldest-universities-world [2]: https://www.mastersavenue.com/articles-guides/good-to-know/the-10-oldest-universities-in-the-world [3]: https://www.guinnessworldrecords.com/world-records/oldest-university [4]: https://en.wikipedia.org/wiki/List_of_oldest_universities_in_continuous_operation [5]: https://en.wikipedia.org/wiki/Byzantine_university
[2]: https://research.com/universities-colleges/oldest-university-in-the-world#:~:text=The%20University%20of%20Al%2DKaraouine,Guinness%20World%20Records%2C%20n.d.).
[3]: https://en.wikipedia.org/wiki/Daigaku-ry%C5%8D
[4]: https://en.wikipedia.org/wiki/Taixue
[5]: https://en.wikipedia.org/wiki/Ancient_higher-learning_institutions#Christian_Europe