Well, castles (and other types of fortifications) have always been an expensive proposition, and both rich people and governments have bankrolled them for centuries, millennia even.there may be only one or two strongholds in the world built with the bankroll to protect adequately against ALL of those threats. At some point, the gold runs out and the compromises must begin.
I think that innovative defenders would gradually come up with techniques for defending against these new offensive strategies as they are introduced. It wouldn't need to be built all at once. Surely they would figure out cost-effective, simple defenses for fantastical attacks would evolve with time through trial and error. I'm not sure that we can figure out what all those defenses would be in this thread in a brief period of time. But I think castle architects would figure them out given time and impetus.
Castles are never built in a day. If money runs out and the protection it affords is not adequate, they can keep adding on and making improvements, over centuries if need be. I don't think that money is necessarily a limiting factor. Especially when there are spells and magical creatures that can help defray construction costs. Some of these were enumerated in the Stronghold Builders Guidebook. If you can summon demons and elementals and celestials, then the construction may go even quicker.
Plus, a lord can use his serfs for little or nothing in pay. Especially if the serfs are motivated to help construct the castle that will protect them in case of attack.
I would think dwarves would be extra helpful with such things as excavation, engineering and stonework, so all the more reason to include them in your community and foster good relations with the people down below. They might be wooed with agricultural products and grain for their beers.
So there are things an enterprising lord could do to reduce construction costs.