Montag burns his house down because he is reacting in rage to Beatty.
Montag feels trapped and betrayed when the firemen, his own crew, arrive at his house. Likewise, Beatty does not care about Montag. Beatty tells Montag that fire is an amazing, wondrous invention.
Its real beauty is that it destroys responsibility and consequences. A problem gets too burdensome, then into the furnace with it. (Part III)
Montag is a burden that needs to be destroyed, Beatty says. Montag gets madder and madder, and this is why he burns his own house down before Beatty can burn him down with his books. He does not go down with his books like Mrs. Hudson because he is enraged, and he turns his rage to Beatty, killing him.
And as before, it was good to burn, he felt himself gush out in the fire, snatch, rend, rip in half with flame, and put away the senseless problem. If there was no solution, well then now there was no problem, either. Fire was best for everything! (Part III)
In a way, he is getting rid of his problem. At this point, he cares more about defending himself than defending the books. He gets carried away, and acts in haste. He feels bad about what he has done, and tries to rescue books as he goes on the run. Yet he is not a martyr. He will not go down without a fight.