The distinction is not whether it’s treated as a fly or as a grounder. It’s based on whether the wall being struck is in the field of play or not. Some walls, or parts of walls, are in the field of play; others are not.
a. If a fly ball makes contact with a wall in the field of play, then lands outside of the field of play, it’s a double.
b. If a fly ball makes contact with a wall in the field of play, then comes back onto the field or to a fielder, the ball is live, and the batter and all runners advance at their own risk.
c. If a fly ball makes contact with a wall outside the field of play, and remains outside the field of play, it is a home run.
d. If a fly ball makes contact with a wall outside the field of play, then comes back onto the field or to a fielder, it is still a home run. An example is J.D. Drew’s home run in this game: anything to the right of the yellow line is considered outside the field of play.
(For the sake of this discussion, the ball will always be in fair territory. Different rules may apply depending on whether the ball hits a wall while foul then goes fair, or hits fair then goes foul.)
Most of the confusion arises when an umpire cannot recognize whether a wall that has been struck was in the field of play or outside the field of play. They’re generally not confused about which wall is in or out; rather, sometimes they cannot discern which wall, or which part of a wall, has been struck by the ball. In those cases the umpire might rule in c. or d. that the ball is still live, thinking that it struck a wall in the field of play. Likewise in a. or b. they might rule that the ball struck a wall outside the field of play, producing a home run. The umpires’ judgment is what matters.
The only way for your scenario 3 to occur - a ball bouncing off a wall, then being caught for an out - is if, in an umpire’s judgment, the ball didn’t touch the wall first. Once the ball makes contact with a wall it is either a dead ball and a hit (in a., c., or d.), or a live ball akin to a ball that has already touched the ground (in b.). It is very unlikely* that an umpire would have such poor judgment that they could not recognize a ball hitting an object such as a wall.
* The exception is Angel Hernandez. Though some umpires make bad calls, Hernandez is the only one I could imagine as being able to get such a call wrong.