If someone learns math in order to better understand a gemarah or studies self-help material as a form of mussar in order to be a better person do these types of learning qualify as talmud torah?
Through the ages there have been various banners over the general category of the interplay between 'Torah' and 'secular wisdom/culture'. Rav Hirsch called it Torah im Derekh Eretz and others call it Torah Umaddah. Within these two approaches the ongoing debate is whether Torah and secular studies (or just 'Wisdom') are both useful but mutually exclusive or whether they should be approached in 'synthesis' and whether maddah is a means or and ends.
Your specific examples, I believe, could include many other things such as (e.g.) botany; which can help you understand certain gemaras (sometimes I wonder how one could understand some gemaras without it), or provide you with peace and tranquility in tending your garden, learning to nuture nature, or as tool to educate children.
Norman Lamm in "Torah Umadda" delineates a number of approaches to the topic and also tackles whether Wisdom (in and of itself) can ever be considered talmud Torah. The sections below correspond to chapters from Norman Lamm's Torah Umaddah:
1) Rambam. Being a master of secular wisdom he (according to Lamm) speaks of secular studies and the "obligation to pursue them as an act of mitzvah". Rabbi Kapah (ha-yahas le'limmudei hol be'yahadut, p.68) "if one studies all these disciplines and sciences which for some reason are called 'secular', in order thereby to attain greater understanding and knowledge of G-d - which is the foundation of all wisdom and without which, according to Maimonides, it is impossible to reach such a state of knowledge - such studies are the holy of holies". "Maimonides... holds that Wisdom has talmud Torah value" (p.139 Torah Umaddah)
2) R S.R. Hirsch - Torah im Derekh Eretz. Torah and Wisdom are not at loggerheads. Torah is the everpresent rock whereas Wisdom is changing and developing. Lamm writes interpreting Hirsch: "they can cooperate, even as the limbs of the body cooperate and coordinate but they cannot interact substantively, even as a sane and balanced person does not interact with or talk to himself... the secular studies help us to understand Torah more deeply...". So it appears from this approach that Wisdom may not directly be considered talmud Torah.
3) Rav Kook approach: "the sacred is not antagonistic to science, but first he reminds us that it vitalises all; it is that which gives life to the secular disciplines. Kodesh and hol are functionally and indissolubly related to each other "The sacred must be established on the foundation of the profane... the stronger the secular, the more significant the sacred". So secular knowledge should be of superior quality if the sacred is to benefit."
4) Hechsher Mitzvah. Wisdom is a means not an end. Hence not talmud Torah.
5) Chassidic Approach. One avodah in chassidut is to sanctify the profane. Lamm argues that it could be extrapolated that secular studies, when undertaken properly can be elevated to the level of kodesh. Perhaps not 'talmud Torah' but of great merit.
While this is largely related to bondonk's answer I would like to narrow the focus a little more closely on the question as asked and expand on relevant points.
The study of mathematics to help in understand the Gemara is an excellent example of what Rabbi Norman Lamm shlita refers to as heksher mitzvah, an act of preparation for a mitzvah, discussed in chapter 8 of his work Torah Umadda. As noted there (somewhat tangentially) this is in compliance with the halachah in Orach Chaim 231 that even an act which is "permitted" to be preformed must be done "for the sake of heaven", i.e. to facilitate serving G-d through preforming mitzvos.
Nevertheless Rabbi Lamm does present a model which he suggests would subsume such [otherwise] secular studies under the category of Limud Torah. The model Rabbi Lamm calls "the Rationalist Model" is discussed in chapter 4 and is said to represent the view of the Rambam. The Rambam understands Pardes as including "Physics and Metaphysics" and Pardes is included in the mitzvah of Talmud Torah (1:12).
This novel approach is not without its difficulties.
First of all, even though the topics the Rambam identifies with Pardes are included in the category of "secular studies" or "maddah" or "chochmah", not all secular studies are Pardes. Some of the most relevant secular studies are in fact excluded from the category of Pardes as prerequisites. We see for example, that Math is not included in Pardes and therefore not "Talmud Torah": "first study Logic, next the various branches of Mathematics in their proper order" (Guide for the Perplexed 1:34, Friedlander). Likewise the moral preparation for the study of Pardes would probably make any musser from self-help books included in the pre-requisites for learning Pardes (ibid). All the more so does this notion fail when it comes topics which aren't even preparation for learning Pardes!
As such all of these subjects must be done with the intent to enable one to preform the mitzvah of Talmud Torah (or other mitzvah) bringing us back to the notion of "heksher mitzvah".
To further illustrate the difficulty of this idea that learning secular studies can be "Talmud Torah" is that the in his commentary on the Mishnah in Shabbos (chapter 13) Rambam prohibits one to study secular wisdom on Shabbos.
In this way we see the dichotomy with the Rambam's position in Teshuvot HaRambam vol. 3 page 57 disappear because most "chochmah" is not and cannot be Talmud Torah even according to the Rambam. And those topics which he did understand as physics and metaphysics are no longer viable scientifically and it is not at all clear that the reasons which the Rambam understood them to constitute Pardes are transferable to contemporary physics etc.