The joke is a pun. Donuts are pastries that have a hole in the center of them. To be tired of 'the whole thing' is to be completely fed up with the entirety of something, however it sounds like the baker is just tired of the holes in the centers of donuts.
A baker stopped making donuts after he got tired of the hole thing .