If he cannot get through a debate without showing incompetence that even all his supporters recognize, how can he be making the day to day decisions of commander in chief? If he's not the one making them, who is? Wouldn't it make sense for him to resign and let Kamala Harris become president? That would seem to help her and deal with his problems.
The 25th Amendment, Section 4, provides a mechanism for the Vice President and Cabinet to act if the President is unable to discharge his duties. Since they haven't invoked this, we must assume they believe the President is capable, despite public perceptions.
Debating isn't an official presidential duty, so performance there isn't a constitutional concern. The President's cognitive state is best assessed by those who work closely with him daily.
If the President were truly incapable, we can't expect him to recognize this and resign. The responsibility lies with the Vice President and Cabinet to make that determination and act accordingly.
The key question is whether the Vice President and Cabinet are fulfilling their constitutional duty to assess the President's fitness for office and take action if necessary.