Other types of ship from the period (whose names I do not know) seemed to have this too - their decks slope upwards to the bow and stern from the middle. The sloping seems to be more extreme as it approaches the stern.
Here's a Verbeeck painting from sometime 1618-1620 that illustrates what I'm asking about - the ship on the left is a Spanish galleon and the one the left is a Dutch warship. https://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Cornelis_Verbeeck%2C_A_Naval_Encounter_between_Dutch_and_Spanish_Warships%2C_156252_original.jpg/1920px-Cornelis_Verbeeck%2C_A_Naval_Encounter_between_Dutch_and_Spanish_Warships%2C_156252_original.jpg
Forecastles and aftercastles on 16th century carracks had several purposes, such as providing extra cargo space and cabins for officers and travelers, but the more important one being that it was a pretty good defensive structure, especially in the early stages of naval gunnery. High structures aft and fore made boarding very difficult, and provided a good position to fire various swivel guns and firearms down on approaching enemy.
However the structures had a drawback of making ships unwieldy and unstable in worse weather as well as overall making the ship slower and less maneuverable. Additionally the increasing number and size of guns and overall maturing of gun tactics ( broadsides ) made the high and large superstructures of carracks easier to hit which meant it was a disadvantage compared to lower to water line, sleeker designs. Carrack size still made it a good cargo carrier which is why they were still used (by portuguese), but ships built with war purposes in mind were usually galleons.
Galleons, recognizable by their front beak, very small forecastle and the sloped, much smaller and usually thinner stern, were much better sailing ships and more suited for increasing gun exchange battles.
Still, the way battles often went, ship being chased and approached from the stern and then after some exchange being boarded was very common and considered dangerous and the ship vulnerable. So there was still an advantage to be had by employing high defensive stern, from which to prevent boarding and shoot down on the enemy. To compromise with the ideal sleeker design was the stern was made sloped and thin.
Final presumed benefit, was that the sloped deck provided defensive advantage when the ship was actually boarded as attackers would have to attack from the middle of the ship "up" the slope, while the defenders could defend from the "high" ground and again shoot from higher position.
Ultimately you have to realize that the ships were often designed by following tradition so far or just intuition and experience of the shipbuilders so even if later designs would prove something was unnecessary or could be done better differently, that would not seem that obvious to the earlier shipbuilders