The reason why Oda previously set it up so that Whitebeard and Oden became “brothers” was also because he wanted to parallel the scene where Luffy announces his goal to Ace and Sabo but then the manga offscreens his goal.
Oda paralleled this in Chapter 966 where Roger reveals his goal to Whitebeard and Oden, but it’s offscreened by the manga.
Both Ace/Sabo and Whitebeard/Oden react the same way to Luffy’s/Roger’s dream as well.
I found it really weird when Oda made Whitebeard and Oden have a brotherly dynamic, but now that I understand why he did so, I’ve realised even more that Oda doesn’t do “weird” things like this for no reason – he has a purpose always.
As to what goal Luffy/Roger had?
I assume they had the same goal due to the parallels between the two characters.
There’s a reason Oda offscreened this goal twice, so it can’t be something that Luffy says every other day (“to become Pirate King”). In other words, there’s more to this than meets the eye.
This is just speculation, but the goal could’ve been that Luffy & Roger want to create a free world where there’s no division between people. Perhaps no World Government either.
This could be why Ace/Sabo & Whitebeard/Oden thought they were crazy or childish.
Throughout the series, it’s been hammered down into the audience that Luffy above all else desires freedom. He’s adamantly opposed to authority.
This goal could’ve also been hinted to us by Roger’s ability’s name (“God’s Demise”) which suggests he’s against the concept of “Gods” AKA, the Celestial Dragons at the top of the World Government who control the world.
This same theme is present in the Skypiea and Dressrosa Arcs (“natural enemy of God”).
Luffy also doesn’t discriminate against people or races.