The Rambam you cite comes straight from the gemara in Yevamot 47a, which continues
And they do not overwhelm him with threats, and they are not exacting
with him about the details of the mitzvot. If he accepts upon himself all of these ramifications, then they circumcise him immediately. [...] When he is healed from the circumcision, they immerse him immediately, and two Torah scholars stand over him at the time of his immersion and inform him of some of the lenient mitzvot and some of the stringent mitzvot. Once he has immersed and emerged, he is like a born Jew in every sense.
So we see that in Talmudic times even the instruction on (some of the!) mitzvot was happening at the end of the conversion process. Remember also how Hillel converted a gentile (Shabbat 31a) before teaching him "That which is hateful to you do not do to another; that is the entire Torah, and the rest is its interpretation. Go study."
The Shulhan Aruch (YD 268:2) builds on the same language and adds "Don't say too much about this [the mitzvot], and don't get too specific either."
The Rambam goes event beyond this and writes (Issurei Biah 13:17) that even if a beit din did not inform a convert of the mitzvot and the punishment for [the failure to observe] the mitzvot and he circumcised himself and immersed in the presence of three ordinary people, he is a (valid) convert. (The SA YD 268:12 disagrees).
There are at least two ways to explain this
R Eliezer Melamed here quotes the Schach (268:4) who writes the reason is that even if the convert is sincere, if suddenly confronted with all of the stringencies and fine details, he will recoil and change his mind about converting. Therefore the custom was to convert a candidate after having been taught a few of the minor and major commandments, and after he undertook to keep all the mitzvot. This was the custom in the past, since a convert always joined a religious community. As a result, it was clear that, in principle, he agreed to observe the commandments. Over time he would learn to fulfil them all, even though at the time of conversion he was only aware of part of them.
R Melamed notes that in recent times, as converts don't always join observant communities, they need to spend more time learning the mitzvot so their acceptance is more meaningful.
R J Simcha Cohen (in How does Jewish law work?, pp. 65ff, online here), brings a number of opinion from R Dovid Hoffman, R Yehiel Yaakov Weinberg (the Sridei Eish) and R Yosef Dov Soloveichik that it is the acceptance of the mitzvot which is critical to legitimize a conversion and a beit din aims to assess if the convert will truly perform the commandments, even if he is - for now - ignorant of law and mitzvot.
Regarding your last question (what if the convert later says he didn't imagine a certain mitzva could exist?) there is a famous Igrot Moshe (YD 3:108) that if one converts knowing he will be unable to keep one of the mitzvot it is a kosher conversion (cited here).