I remember one episode (if my memory serves me right) where Major Monograma told Doof that, when they get back home, he will be arrested.
But why don't they arrest him permanently, so he can't do all those bad things despite the shows premise?
I want an in universe answer, but not like the "Characters in Phineas & Ferb TV Show are aware of the 4th wall, so they are making an "illusion" that they are in a TV Show. Otherwise, there would be no show at all".