a pun, not an ethnic joke
To me, it is neither, but that horribly wonderful invention, the Shaggy Dog Story.

The classic SDS relies on inordinate length, culminating in an atrocious inversion of initial letters (which AIN'T a pun!) - like the "Basques in one exit" story (in its many variations.)

Or the punchline to the story of the African chieftain who collected thrones and kept them in the roof of his house, which was constructed of straw and eventually fell down, proving convincingly that people who live in grass houses shouldn't stow thrones.