That said, after a fly-by or two, every exposed wooden section of the structure would be on fire. Afterwards the walls would be scorched and partially melted together.* I imagine that if the stone is hot enought to partially melt, any wood touching it would start to burn. A tail lash would like knock down weakened stone work.
How big is the breath weapon compared to the size of the castle. I think it might be foolish for the dragon to get this close, but if it landed in front of the wooden castle gate a single breath would destroy it.
I wouldn't have it flow around corners, but if you are right next to it I would consider you making a save for half vs quarter damage. It makes sense to me that hiding behind some stone should count for something. Still, you're right next to some hot magical fire there, and there is a lot of radiant heat I would imagine.
They had better have some ballista or some good archers. They're in trouble.
* There was something I saw somewhere about partially vitrified stone walls in England I think. Might be interesting to research.
ncG1vNJzZmivp6x7prrWqKmlnF6kv6h706GpnpmUqHylvsCgpqerXZe%2Fpq3ToWSwnZGlvK951axksJmcoXt3g5BuZ25n