In an earlier version of the film He pulled himself free as the Hulk. The film then left this as a hanging plot point because the Hulk was edited out of the final cut.
We now know that there was a scene where the Hulk finally emerges and busts out of the Hulkbuster suit during his fight with Cull Obsidian, as evidenced by some recently released early VFX footage showing Banner emerging from the Hulkbuster suit as Smart Hulk ("We worked it out")
We also have this still (from the cinematic trailer), showing a veritable army (including the Hulk) charging toward Thanos in the forest and various toys designed before the film was changed in post-production.
We also have confirmation from the screenplay writer that this change was intended and filmed, and only fixed in post-production VFX at a later date.
Originally scheduled for a last-minute arrival in Infinity War, Banner
and Hulk were going to strike a deal during the Battle of Wakanda.
Professor Hulk was supposed to tear out of the Hulkbuster armor and KO
Speaking on the Endgame commentary, McFeely said, “It was pretty clear
that the movie could not handle this weird success. The movie needed
to just stay in its succession of losses in the third act, which meant
some hustling on the part of VFX late in the game."
All the Infinity War storylines that got dropped before the final draft
While the directors deny that this scene was actually part of the movie(!), It seems more likely that in the earlier cut he was fully 'hulked' when Thanos zapped him into the rock.
Given the Hulk's constitution and rapid healing, being phased into a wall wouldn't kill him but would, presumably incapacitate him for a while, nerfing him until the fight with Thanos had already concluded, at which point he could just pull himself free.