At least the dwarf women joke was referring to fact....
In one of the books of criticism I have read (and I will check), the author points out that Gimli does NOT joke.. he makes only one jest in the whole thing and that is when he finds the hobbits smoking in the ruins of Isengard.
However to be fair to the filmmakers once you have got through the native stamping grounds of Moria and Lorien, Legolas and Gimli are not essential to the plot. They are companions to Aragorn, representatives of their fading races (not something that was highlighted anyway in these action orientated film), but no significant twists rely on them as with Merry and Pippin. However you can't get rid of them.So what do you do with them? Legolas slips into pretty boy eyecandy and Gimli is the funny man....