I'd probably say the scene could have been toned down and not played for laughs if there was a better first act in place. Sometimes humour is used as a defensive tool in order to cover weaknesses in story in the same way an action sequence is used. That's not to say the jokes can't be funny at the time, but it's not until afterwards you go 'hang on a second...'. However for some people the jokes don't work when they watch it, which I can understand.
Those, plus Sif's feeling about Thor, but specifically his mum's death. It's actually a good reason for Thor and Loki to go after Malekith from an emotional perspective, however there was no real Mother/Son relationship built up to that moment in this movie, or even in the previous film. The real relationship is Thor/Loki. As such there's never any sense of there being anything personal about Thor taking on Malekith, the humour toward the end of the film further dilutes that. I honestly forgot that his mum died in this movie by the time the finale came about because things started getting a little bit silly toward the end. The emotional stuff happened in the previous act with Loki.