Employing this to a tabletop game, depending on the game system, you could extrapolate the costs of building a castle from this information. Assuming silver as a standard unit of currency and occupying a healthy mix of professions into the construction of this castle, you can expect to spend about 20 silver every day or 600 silver every month. Over a 20-year period of time, that amounts to 144,000 silver pieces. If gold is your currency standard then you can increase that to 1.4 million silver. That's just to pay people to build the castle, that doesn't include building materials or tools or all of the hiccups that might occur along the way like labor disputes, foul weather, running out of materials, bandits, wandering monsters, war, or anything else that might delay or stop construction. The construction times listed in the 1st edition Dungeon Master's Guide are very forgiving.
You could buy the Castle Guide and plot out exactly how much stone, how much gold, and how many workers with a very good basis of management and flexibility using a gold standard, but most of the people I play with find that attention to detail boring. If that's the case for you as well, then...
Handwave it!No castle is typical or average, each must be specially designed. The smallest of castles will take 15 years to build, larger castles might take upwards of 25 or even 50 years to build. Every year of uninterrupted construction costs 7200 silver pieces for labor, assuming stone is relatively easy to quarry and wood is readily available from a nearby forest or grove. An NPC wizard will need to be paid in order to help, but a PC wizard can be handwaved into assisting and dramatically reduce construction time. For each NPC wizard who assists with construction increase the cost by 50% and divide the construction time by their level (or combined levels); PC wizards simply divide the construction time by their level unless the players have negotiated a wage between their characters.
For example, Brienne's castle is huge and is likely going to take 35 years to build costing 252k silver. She has a 12th-level wizard assisting her so the total cost will end up being 378k silver but will only take 2.9 years. If another 10th-level wizard helps, the cost increases to 567k silver and will only take 1.6 years.
Castle by David Macaulay
Life in a Medieval Castle by Joseph Gies
Medieval Castle Layout