I realize that Cortes might not have burned them intentionally on arrival in Mexico. I'm just curious about how boat repairs would have happened on long expeditions and if boat building was common knowledge. Would a ship full of soldiers have been able to build a ship from local materials and sail back to Spain?
While /u/TheReadMenace addressed part of the question (specifically scuttling, what actually happened, vs. burning, what the myth says happened), I'll address the logistics of rebuilding the boats.
The short version of the answer is: "really friggin' hard."
To expand on that, it's important to remember that Cortes couldn't just pop on down to the local lumber mill and buy pre-cut wood to the length he'd need (nevermind the seasoned lumber he'd need, since putting unseasoned lumber into ships is a really bad idea). He had to source the lumber locally.
But the ships didn't require just lumber. They also required all sorts of other stuff. You're probably familiar with the usual appearance of a wooden ship's hull, which is a fairly smooth exterior. That's called carvel planking (as opposed to clinker or lapstrake, which is sort of overlapping). And when you're actually building a boat, it looks like this. That white stuff there? It's there to fill the gaps between the boards because the boards aren't supposed to fit perfectly (the caulk there, usually made of oakum or pitch in period-appropriate reconstructions, essentially allows boards to expand and contract slightly while keeping the fit watertight).
What you'll also notice from that image is that the boards themselves are not square like you'd expect from buying lumber at a hardware store. Those boards weren't bent into shape -- they were purpose-grown into shape. A tree would be planted and encouraged to grow in a certain way so that the end product was what the shipwrights wanted. This process is probably vaguely familiar to you; the garden trellis is used in a similar way to encourage climbing plants (in this case tomato plants) to grow in a certain way. You'd just need a bigger and beefier system to get an oak tree to grow the way you wanted. The masts, on the other hand, required unusually tall and straight trees.
There's also the matter of ropes and sails. While you can make them from a number of different materials (probably something like linen for the sailcloth, hemp for the ropes), the Spanish are an ocean away from their traditional source of materials.
All of these things would have meant it would be exceptionally to build a large, ocean-going vessel from local materials alone, especially since the Spanish likely didn't have many (or any?) shipwrights with them. Those ships would've had their own ship's carpenters, but a ship's carpenter is about as well-equipped to build an entirely new ship as an auto repair mechanic is to build a new car.
So, if Cortes actually did burn his ships, he would've been stranded there. But he didn't. And, besides, getting a ship that can sail to Spanish-held Cuba from Mexico is a lot easier than building a ship that can sail across the Atlantic. And it was only two or three years until fresh reinforcements from Cuba came anyway.
No Smoking Please
As noted, the ships were not burned, that is a bit of poetic license that came later and parallels the a trope from Classic literature. Cortes, in his 2nd Letter, merely says that he "determined, under the pretext that the ships were not seaworthy, to cause them to be stranded on the coast" and that he did this because he feared mutiny. Of course, Cortes was writing back to Charles V in an attempt to justify to the monarch his reasons for greatly exceeding his legal authority to the point that expeditions were sent from Cuba to arrest Cortes. Sending a letter back to Spain to explain that he scuttled his ships after already deciding to mount his own independent expedition in Mexico would be a damning admission.
Yet, that is exactly what Diaz del Castillo said what happened. While not denying that preventing any chance of mutiny might have been a motivating factor, Diaz del Castillo explicitly says that the Cortes Expedition was already intentionally operating well outside of their legal authority. He also surmises that, but sinking the ships, Cortes might have a plausible way of getting out of paying for them (Cortes borrowed considerably to fund the expedition). This is from an older Lockhart translation:
While preparations were going on at Sempoalla for our march into the interior numerous consultations were held with Cortes respecting everything connected with it, we, his trustworthy adherents, proposed that all the vessels should be run on shore, in order at once to cut off all possibility of further mutiny, when we should have advanced far into the interior of the country. In which case, likewise, the pilots and sailors would be of greater use to us than by idling their time away in the harbour. I am well aware that the idea of destroying our vessels originated with Cortes himself, and that he merely shoved it on our shoulders for this reason, that if payment for the vessels should be demanded of him, he could throw the blame on us, and say that all was done at our own request; so that we both individually and collectively should have to assist in repaying the damages. This resolution was immediately adopted, and Cortes ordered the alguacil-major, Juan de Escalante, a young man of very great courage, and who was a close adherer to him, utterly hating Diego Velasquez because he had neglected to give him any considerable commendary in Cuba, to take all the anchors, ropes, sails, in short everything that might be of use to us out of the vessels, and run the latter all on shore, with the exception of the boats.
Lakeside Parallel and Perpendiculars
As for your actual question, we have an interesting parallel to your question in the events of the Battle of Tenochtitlan. As part of the massive and on-going naval theater of operations, Cortes ordered 12 (sometimes stated as 13) brigantines constructed. The man who volunteered for this task was Martin Lopez, who had sailed with Cortes' original expedition. Lopez is sometimes called a shipwright, but evidence suggests that he was instead of minor nobility and had no prior experience in ship-building. Instead, what he had were a bunch of very talented servants who were craftsmen and possibly had actual shipbuilding experience. He also got some practice in prior to the brigantine build, since Cortes had instructed him to remain behind in Vera Cruz while the main host of Spanish traveled inland. There, Lopez was set to building a caravel, a task which was still not completed after several months.
It is unclear when exactly Lopez and his crew began building the brigantines -- whether this was begun before resumptions of war with the Mexica in late 1520 or whether the building began after Battle of Tenochtitlan had already begun. Cortes gives the launch date of the ships as 28 April 1521, so we can reasonably guess that several months of work went into their construction.
Unfortunately, this parallel has problems. First, Lopez et al. had already had practice in shipbuilding at Vera Cruz. Second, the brigantine were not intended to be sea-worthy. Third, at this time several other craftsman had arrived as reinforcements from Cuba. Fourth, there was a constant supply of materials coming from Cuba, which included ship-building materials like sails, tackle, nails, etc. And, finally, the Spanish had the support the entirety of Tlaxcala and most of Acolhua in building the ships, which meant access to not only thousands of men for raw labor, but also skilled woodworkers and the collective knowledge of groups who had been lumbering the eastern shores of Lake Texcoco for generations.
As /u/Imperial_Affectation notes, shipbuilding was highly skilled labor. It is conceivable that the Spanish could have constructed ships to take them home eventually, but they would not have necessarily have been the fully seaworthy vessels they arrived on.
More reading: Gardiner's Martín López: Conquistador Citizen of Mexico and Naval Power in the Conquest of Mexico are a bit dated but relevant.