I’ll note that @Johnny_L.A’s picture is of a preliminary design that was not actually used. As built, @Sooner’s explanation is correct as far as it goes, but is missing an IMO relevant point.
As they said, there were two, not three, main battery turrets forward housing 3x 46cm/45 guns. But there was a third turret direct aft of #2 that’s superelevated above the first two. It’s smaller, being one of (originally) four turrets of the secondary battery. It housed 3x 15.5cm/60 guns.
See Japanese battleship Yamato - Wikipedia as well as the related article on the Yamato class for many pix corroborating this.
It’s also obvious that the third foredeck turret is far smaller & lighter then the two main battery turrets. So it was feasible to raise that lesser weight to that height without excessively destabilizing the ship.
In looking at the overall idea of the preliminary design, we see all three main batteries forward and all three secondary batteries aft. From both a weight and a recoil POV that’s not as stable as splitting each battery between fore and aft.
Separate but related to that …
In more typical battleships with two main batteries forward and one aft, the #3 battery can’t fire into roughly the forward quadrant at all; the whole superstructure is in the way, plus whatever midships smaller armaments are sticking out.
Moving the #3 battery forward, but not superelevated over #2, as the preliminary design had it, would have somewhat improved the field of forward fire of the #3 turret, so maybe a 30-40 degree excluded cone dead ahead instead of 90+ degrees. But at the expense of eliminating roughly the entire rearward quadrant.
Being able to fire at least one turret of main guns at any pursuer sounds like a feature it’d be very desirable to have. Any opponent knowing your configuration would know they have a completely safe haven of approach if they can get within your aft quadrant and outside fo secondary gun range.
It’s tradeoffs everywhere you look. Battleships were pretty much limit case designs pushing the state of the art in everything about them at their time of design. And between the e.g. 1900s and the 1940s, one heck of a lot of progress was made in that state of the arts plural, leading to rapid obsolescence of the ships as built. hence the many hurry-up efforts to refit and improve ships not that long after their first mission.