Who said this is his dream lol? And who says Luffy HAS to take part in it? Giving his dream to the world does not mean he didn't accomplish it.
One Piece is ine of the few manga that constantly looms death flags around the MC. And I mean quite frequently. Luffy talks about dying for his dreams, die smiling, dying from using his powers, and as most recently, with G5.
There is nothing harming his dream if he actually dies accomplishing it. Oda has alluded to the ending being bittersweet. I'm just saying this is why I think it will be.