In hindsight it was a mistake to agree to a debate before either was actually a nominee.
Trump could have just "let's wait until we're both nominated". Sure he'd have caught some flak for "ducking" the debate, but Biden would be the candidate, and would continue his cognitive decline.