By this, I mean a castle built without terraforming or draining the swamp; a castle that was built while keeping the swamp intact.
As noted, this type of castle was extremely common.
Harburg (Horeburg/near Hamburg), the first castle at Danzig are perhaps the most famous of these. They were most often built along the Northern European plains on the South shore of the North sea and the Baltic Sea. But that is only indicating that a lot of wetlands can be found in those regions.
They were popular everywhere where there was enough water influencing the surrounding terrain to form a natural obstacle for approaching enemies. A clear cut definition and distinction between swamp castle and water castle seems difficult. Today, many of these were either transformed into more comfy residences in later years and thus lost their military character (quite late construction date exception of Bourtange in Groningen), had their marshlands drained, or they did succumb – not in the least through military actions – or in their construction itself, due to the permanent water stress upon the construction.
Then of course, Prince Philip, the Duke of Edinburgh springs from a family that had its seat at Glücksburg Castle.
Castle Vischering might look most like what we expect for a medieval castle:
But to get even more to the point of Monty Python: they did not have that much money for extensive props. So they just used an existing castle:
For comparison, picture from question:
And the original:
and as pictured in the movie
Bodiam Castle was used in Monty Python and the Holy Grail in an establishing shot identifying it as "Swamp Castle" in the "Tale of Sir Lancelot" sequence
The difficulty in differentiating these types of castles may be illustrated in this watercolour picture by Wilfrid Ball in "Sussex Painted" (1906):
The often found subsequent difficulties with water damaging the construction lead to some inventions:
The motte proper was a conical mound which might vary considerably in size (between 6 and 15 m). The motte could be completely man-made—an important or even enormous undertaking—but if there was a suitable hill in the area it would be adapted by scarping, that is, cutting vertically down the sides and digging away the lower slopes. In certain cases, to avoid the shifting of materials and to provide greater stability to the motte, alternating layers of stone, peat, clay, chalk, rubble, gravel, brushwood or sand were inserted between rammed or beaten down layers of earth. Finally the whole mound was revetted with a thick coat of clay to keep out water. With this technique the builders could create a dry place in a possible swampy area, or keep the castle out of reach of the river in low lands. The base of the motte was surrounded by a ditch, which may have been filled with water. Some of the material for the motte was derived from the ditch, but in some cases additional materials were required to bring the mound up to any appreciable height.
A great majority of medieval moats were dry, but de pending on the natural situation, some were filled with water. A wet moat, called a douve or wet ditch, formed a very efficient obstacle against the assaulting party. However, wet moats could be something of a mixed blessing; they were inconvenient in peacetime, which meant that unofficial bridges were often erected—with subsequent argument and indecision about the right moment to chop them down in an emergency. Besides, water might dangerously erode the base of the wall, and stagnant water might be a year 'round health hazard for the inhabitants of the castle.
The water for a douve could simply be collected from rain, but because this source was unreliable, the wet ditch was very often supplied with fast-flowing water coming from a river or sea by means of dikes, sluices, watergates and derivation canals. In certain cases, wet ditches took on the proportions of a lake, a marsh or even an intentional flood.
The architect and the lord or trustee would decide together the best place to build the castle. Their choice was influenced by various strategic, technical and financial considerations, and nearly always involved a site favoring defense such as a high ground, a spur, a hill, an island or a marsh.
When a portion of ditch was dug, masons built strong wall foundations (remember that castles were vertical buildings demanding stability). In good ground conditions large flat stones were tilted inwards to take the thrust of the wall above. When the ground was less stable, masons start with a framed-up timber raft; on marshy ground they had to install timber piles driven deep.
Constantly, the master-builder had to supervise all of the construction, control alignments, check material quality and so on. To all these tasks were added the construction of echauguettes, gatehouse, houses, chapel, lord's residence, dungeon, and more. And the conception and construction of the castle were even more complicated in mountainous sites where transport was difficult and weather unpredictable. Spectacular difficulties were met in wet or marshy sites.
Certain cities owed their growth to the installation of a royal, imperial, princely or episcopal court and became national, regional or provincial capitals. Many others were rebuilt or created because of a favorable geographical situation (for example, a passage in a marsh or between mountains, a ford on a river, a junction of important cross roads, or a protected anchorage) because accessibility favored the installation of trading-places and markets.
Cross-section, Tour de Constance in Aigues-Mortes (France). The huge Constance tower, completed in 1248, was a 32 m high cylinder, 22 m in diameter with walls 6 m thick. Built in a swampy site, the tower rests on solid foundations composed of pillars. The tower includes two vast vaulted chambers and a crenellated top platform with a watch-tower used as a lighthouse.
–– Jean-Denis G G Lepage: "Castles and Fortified Cities of Medieval Europe. An Illustrated History", McFarland: Jefferson, London, 2002.
That means for construction that builders tried to take advantage of natural conditions: drier, raised land, like in Glücksburg, where the construction rests on a natural granite base. Simultaneously or alternatively, they used compressed earth and mixed material they tried to seal from the wetness primarily with clays and rested the foundations on wooden beams, like on a grand scale found in Venice. In both examples, the permanent difficulties stemming from the wetness and continuing to this day illustrate how difficult to maintain these constructions were and are.
The case of Danzig/Malbork castle illustrates another aspect. We can only analyse a fairly short time period in which the castle existed in the 'desired' form. The necessities for upgrades over time were already quite pronounced. The present day appearance is much more solid than the first iterations:
The Knights quickly overran the lower reaches of the River Vistula, building their first castles during the 1230s, of timber and earth banks. In a land of rivers, swamp and forest, a scanty supply of good building stone meant it was used only for foundations.
–– Dan Snow: "Battle Castles", Haperpress: London, 2012.
A problem from the conditions for answering this question is the assumed absence of "terraforming". Building the castle itself is a part of terraforming. In the middle of a swamp no big building can be erected without manipulating the ground for it to be able to hold the weight of the structures above it. Further it was always desirable to ensure the surroundings keep their deterrence and obstacle properties. That means castle owners would have always liked to have some more control over the water level. To prevent the swamp or marshland to become too dry, or even increase its effectiveness by initiating a flooding.
As the fate of most of these constructions who were not real water castles on a river island or a proper lake shows, these castles in swamps or marshes were most often only a temporary phenomenon. Not only for health and safety of the occupants or the buildings themselves. Ironically such castles became often small population centres. And ordinary people often had less interest in this inconvenience of wetlands next to their housings, but generally preferred usable land close to home, so that eventually most swamps and marshes were drained, or even dried up naturally.
Further examples to investigate – not for their present but for their initial appearance would be:
Wyher near Ettiswil, Gifhorn castle, the oldest still existing Burg Oebisfelde, Lembeck, Hülshoff, Dunguaire Castle, Mespelbrunn or the sometimes suspected oldest stone castle of which no traces remain from the series of Loire castles Doué la Fontaine, Château de Sully-sur-Loire.
The Teutonic Knights had come from the Holy Land to Prussia well experienced in the building of castles, but in the savage lands of the north the environment and conditions for construction were very different. Their Prussian territories were almost literally carved out of the dark forests and swamps with their meandering rivers, and the pioneer knights were handicapped by a shortage of labour, no local building skills and few deposits of workable stone. The technology of building in brick existed and had been demonstrated effectively in Denmark, but the settled conditions and reserves of manpower simply did not exist on the Prussian frontier. The result was that the first Prussian castles resembled those of the natives that were destroyed by the Order's army. They were often hastily built from timber, usually oak, because the stone laboriously gathered from fields was only sufficient for foundations. The forts were thus rough-hewn wooden blockhouses, sometimes built upon a crude and simple stone base of undressed boulders, encircled by wooden palisades and with the lay of the land determining the contour of the walls. With so many rivers and swamps around, water defences played an important part in a castle's layout. Rivers provided a barrier in summer and roads during the winter, so the castles were often located on a promontory where two rivers met. Wooden castles were of course vulnerable to attack by fire, so during the 13th century an attempt was made to bring masons in from Germany to build stone castles. However, as noted above, stone was scarce, and in Prussia no more than five castles were converted from wood to stone by 1250, so timber kept the knightly communities alive until brick succeeded stone as a cheaper and more readily available material. The average garrison of a wooden castle would be about a dozen knights, together with 100 or more soldiers, mercenaries, native militia and servants. In time, all the permanent castles of Prussia were converted from wood to brick, but it is also important to note that wooden castles continued to be built even when brick castles were well established, but these were constructed as temporary fortresses during expeditions into enemy territory. If such a foray was likely to take some time, then it was sensible to build a temporary base rather than rely on a succession of flimsy encampments.
–– Stephen Turnbull: "Crusader Castles of the Teutonic Knights (1). The red-brick castles of Prussia 1230-1466", Fortress, Osprey: Oxford, 2003.
While I absolutely agree with @LangLangC's answer and especially his quoting of Turnbull for turning towards the castles in Eastern Europe, I think there is potentially too much emphasis on the necessity of terraforming (but just emphasis, not disagreeing with actually needing some). Mottes are an obvious example of how human-driven landscape change was an aspect of castle building, but a similar emphasis could be placed on the original search of places in the middle of a wetland in order to build there. While the focus of this subject is on "castles", I hope this answer adds a different aspect to why pre-Western European settlements existed in boglands (and also 'how').
Wooden & Stone Castles in North-Eastern Europe
It should be firstly noted that the above answer (@LangLandC's) is probably a better one if we only consider about stone castles. However, most castles originally started out as wooden structures (Turnbull's 'Crusader Castles of the Teutonic Knights'). This was also true of the native Baltic and Finnic tribes in the north-east of Europe -- who really only built wooden structures up until those lands were taken over by the Germans/Swedes. Wooden structures are also considerably lighter than stone ones. Note that this is not to say no stone elements were incorporated by these peoples, but that the main instrument of construction was wood (mortar being unknown and the stones in loose placement with respect to each other (Turnbull)).
As the North-Eastern European territory geographically encompasses a lot of wetland, these types of wetland-constructions also were more common in these lands than in say Italy or France. Also, in previously 'civilized' Europe landscape architecture would have been happening for about a thousand years, incl. draining wetlands to create farmlands.
From D Lindholm's 'The Scandinavian Baltic Crusades, 1100-1500':
The local terrain tended to pose problems even in this form [normal seasonal campaigning] of warfare: the many lakes, rivers, streams, bogs and marshes formed such hazardous and sometimes unpredictable barriers that it was all too easy for the raiders to get caught by a rising lake or a ford that was no longer passable because of unexpectedly heavy rain or melting snow.
Note on Sources
Regrettably, I don't think many of the sources I can provide for the below are available in English; hence my referring to the Estonian WP and other such articles. I think similar comparisons could be made in the Mazovian Lowland of Poland (but not my speciality), around the Neva River (Keksholm is not an amazing example, being more on a river island, but the Swedes also supposedly erected a small castrum in the mouth of the Neva, I think), and in modern Lithuania/Latvia as well, but probably similarly those sources will be more available in the native languages. I have, however, tried to illustrate my points below with reference to land cover and land elevation with reference to the Soontagana fortified settlement (castrum Sontagana in Henry of Livonia's chronicle).
The Soontagana settlement was an inhabited fortification in Western Estonia between the 10th and 13th centuries (but perhaps as early as the 7th century), and conquered in 1215 by German crusaders (though in use for some more decades). The settlement was built in the middle of a bog on a natural limestone-base island. This was a strong and central settlement of the surrounding areas. The bog island provided the original location for the settlement, but
... the inhabitants had to expand the limestone high on which the settlement was built, incl. raising the edges and making the slopes steeper. Around the castle, an earthen wall was built from the same material that was dug out of the foot of the castle. The resultant moat helped increase the relative height of the castle. This earthen wall was supported by a wooden framework. Similar defensive structures are well known from our other neighbouring lands.
The interesting part here applies to the relative importance of the settlement with respect to the very defensible location that it seemingly had (which would imply a lower level of connectivity). This is explained by roads (both local and regional) running through the area, with Soontagana as the central connection point. However, unlike Western European roads, these were intended for winter use where the frozen boglands would be easier to trespass (the Christian conquest of 1215 also took place in the winter):
It was also during the cold winter of 1211/12 that the Swordbrothers made the surprising and important discovery that winter was the best season for warfare. The swamps froze, the undergrowth was less solid and the natives had difficulty covering their tracks. The mounted German knights could also use the frozen rivers as highways. [Turnbull's 'Crusader Castles of the Teutonic Knights, 2']
With respect to year-round travel, excavations and construction in the area have uncovered stumps which seem to have been the basis for such roads.
One of the other things which is emphasised, however, is that it's nearly impossible to consider these problems without considering the development of the wetland itself. In this case, Tõnisson postulated that it was slightly drier when the settlement was in use, with other islands also reaching out of the bog-surface, but still wet enough to provide a credible defense.
By the 21st century, the bog has again been (slightly) drained compared to what it was in the 19th and early 20th centuries when many of the investigations took place.
The images below illustrate land cover and elevation around the bog-island with respect to the fortified walled settlement location. Even assuming the water level to have been a metre or two higher (the bog-island today is actually more a peninsula, connecting to the drier forests to the south), this location is clearly easily defensible in the summer. I've used the contours to highlight the location of the island on some images (but removed them from the bog as not much elevation change there) and to make its location clearer.
The people must have also had a good reason (especially considering the longevity of the settlement) to build it here and not on the much higher ground just outside the wetland (as seen to the south-west on the images).
Overall, I hope these illustrate that presently to the north there exists a similar wetland as probably existed to the west of Soontagana in the past -- the ditches that have been used to dry the area are quite clear.
The non-fortified part of the bog-island would have been used for agriculture and been the home for farmsteads.
Lastly, I'd make a point that certain wetlands can be healthy -- if the water is not still, but moves slowly through the wetland, for example, then there shouldn't be a health problem. Health problems arise from still waters. Most, or at least many (I can't source-quantify), wetlands in Northern Europe are somewhere where an outflow of water exists (and the water-level is maintained by ground-water upwelling, rainwater, or water flowing into the bogland).
Lastly, on economic activity... I've not really gone into depth on this, but bogs were the source of bog-iron and also peat (which could be used as fuel). Hence, we are rather looking at a source of economic activity rather than a sink (perhaps especially so in a mostly pre-agricultural North-Eastern Europe setting -- again, I'm not very sure about the quantifications).
I hope to have illustrated a case herein where terraforming was a deliberate choice (but not a necessity -- except to enhance defense). The land in this case at Soontagana was chosen because it was a naturally good position (limestone outcrop) in the middle of a wetland. Humans were able to modify this position to be even better from a defense viewpoint while the bog-island supported potential economic activities that could be undertaken in the natural region.
This is distinct from later German- or Scandinavian-origin castles because such an inland site would have been away from the Baltic Sea trade routes that they would have benefited from (and wanted to use).