SDL game loop

Was the code sample I wrote to you in this thread not usable: SDL2 switch animation?

You don’t seem to use that version of the code, since you’re back on using the SDL_RenderClear and SDL_RenderPresent functions multiple times in your current code again, which I adviced on not doing.
One (1) call each to those functions per game loop is enough for most cases.

It won’t solve the issue with your current code though.
I haven’t read through the whole code but you should probably check if the mouse pointer is inside any of the buttons, and if a mouse button is pressed while still inside it, change the application to some menu/screen.

You should look up a term called “game states”. That pattern/code design lets you construct various states the application/game can be in and also lets you traverse between those states, for example a menu state, a settings menu state, a game state etc.