Dense molecular cocoons in the massive protocluster W3 IRS5: a test case for models of massive star formation