It is possible to insulate a build from fire sources. While fire can spread into a protected area, it can’t be started inside, so you can leave a gap of only non-flammable materials around the inside of the protection. I’ve let tnt mobs go off in my protected area as a test, they still deal damage to players but don’t leave a crater.
I rebuilt the bottom part of the spawn building out of non-flammable material to protect it against lava flowing into the area. For better defense I’ll have to widen the protection, and add a non-flammable roof. Eventually.