To oversimplify some (still debated) basics of dating – the Mishnah is a late 2nd to 3rd century (or later) collection of writings, the Tosefta a 3rd to 4th century collection, the Jerusalem Talmud a 4th to 5th century collection, and the Babylonian Talmud a 5th to 6th (or later) century collection. In other words, these are primarily Late Antique writings. Also, many of them are framed as commentaries on earlier collections. And there are still many, many other collections of Late Antique Jewish writings.
To oversimplify history of scholarship on the composition of these collections:
Traditionally, scholars more or less took how these writings presented themselves at face value – as written records of [A] debates, [B] traditions of interpretation, and [C] teachings among Rabbis of much earlier periods (e.g., 1st century CE). The writings were viewed like literary sediment requiring excavation to retrieve authentic earlier teachings. Thus commentators would even try to write biographies of specific, much earlier Rabbis by surveying things said about them in different collections of Rabbinic writings. Given that this is a subreddit devoted to “Bible,” it is worth noting that, unfortunately, the vast majority of New Testament scholarship that engages with Rabbinic literature still operates from work or assumptions of these traditional approaches.
More recently (esp. over the last 50 years) it has thankfully become more common for scholars to, in different ways, treat each of these collections as literary products of their Late Antique environments, as reflecting social and political interests of their literate producers in those contexts as they dialogued with, competitively interpreted, rewrote, or invented earlier Jewish writings or teachings. In this movement of scholarship it would be more common, for example, to approach what different collections of Rabbinic writings “preserve” about X, Y, or Z famous/legendary earlier Rabbis as literary (re)creations to authorize or speak to interests in the Late Antique contexts of the Rabbinic writings themselves.
An important characteristic of these more recent approaches is also a consciousness that we should not treat Rabbinic literature as co-extensive with Judaism or “what most Jews thought/did” in their times. These writings were part of the attempts of small handfulls of literate Late Antique Jews to define authentic piety and monopolize the prestige or legitimacy of their customs and ancestral writings (e.g., the Hebrew Bible) in ways that promoted themselves and the self-evident importance of their scholarly activities. But to be clear, that does not make the Jews who put these collections together unique. We can approach most ancient Jewish and Christian literature from similar vantage points.
Tradition and the Formation of the Talmud (https://academic.oup.com/princeton-scholarship-online/book/20378)
This book offers a new perspective on perhaps the most important religious text of the Jewish tradition. It is widely recognized that the creators of the Talmud innovatively interpreted and changed the older traditions on which they drew. Nevertheless, it has been assumed that the ancient rabbis were committed to maintaining continuity with the past. This book argues on the contrary that structural features of the Talmud were designed to produce a discontinuity with tradition, and that this discontinuity was part and parcel of the rabbis‘ self-conception. Both this self-conception and these structural features were part of a debate within and beyond the Jewish community about the transmission of tradition. Focusing on the Babylonian Talmud, produced in the rabbinic academies of late ancient Mesopotamia, the book analyzes key passages to show how the Talmud’s creators contrasted their own voice with that of their predecessors. It also examines Zoroastrian, Christian, and mystical Jewish sources to reconstruct the debates and wide-ranging conversations that shaped the Talmud’s literary and intellectual character.
If you want to pursue some of this, a relatively more accessible entry point would be Charlotte Elisheva Fonrobert, ed., The Cambridge Companion to the Talmud and Rabbinic Literature. For a more sustained treatment, see Hayim Lapin, Rabbis as Romans: The Rabbinic Movement in Palestine, 100-400 CE.