In the end, Stuttgart really didn't want to be beaten by Hamburger SV. In fact, in the second leg which was played at home to Hamburger SV, at least Hamburger SV could have better statistics and that allowed Hamburger SV to be able to win even if only by 1-0. But in the second half Stuttgart again scored three goals and ended the second leg with a final score of 1-3 and that means Stuttgart managed to win 6-1 on aggregate. With these results, of course, Stuttgart remains a team that deserves to play in the Bundesliga next season.
I think everything was clear after the first game and the players of Hamburg did not believe in a positive outcome - with such a mood (objectively justified when the result of the whole season has already been lost) it is difficult to win even with a minimum score (which will not give anything anyway). Plus, by the end of the season, Stuttgart got in good shape (by the way, they took away points from Dortmund by drawing with it - as it turns out, this was way important) and therefore they easily won the second game as well.
But apart from that, the fact is that this season is Stuttgart's third season playing in the Bundesliga after successfully being promoted back from the 2. Bundesliga in season 19/20. During his first season, Stuttgart returned to play in the Bundesliga in the 20/21 season, Stuttgart managed to finish in a very good position, because Stuttgart managed to finish in the top 10 of the final Bundesliga standings in the 20/21 season.
But after that, Stuttgart experienced a drastic decline again and almost got relegated too in the 21/22 season and this season, Stuttgart finally finished in the relegation zone. But yes, at least Stuttgart were lucky to win in the playoffs and in doing so, Stuttgart managed not to be relegated after two seasons, with poor results.