Fun!
Your first idea is pretty good I think. Those types of defenses can be real handy - but a rampaging dragon may well take yall down with the attackers.
Can they breathe fire through windows? Maybe you can build a "jail cell" for him on the front of your fort, with an aperture he can shoot flames from, like an automated flamethrower turret. But you can do similar things with magma, idk if it'd work better or not.
It's been a long time since I played much and I've never been half as good at engineering this stuff as a lot of people