Unless they didn’t.
There’s nothing inherently valuable about crypto beyond what value people assign to it in their minds.
But that's irrelevant to the question above. The question asks "isn't [this attack] the same as saying that if everybody agrees that the USD is worthless, then it is worthless?".
The answer is "no, it's not the same". The attack does not require everybody to agree that the bitcoin is worthless.
Obviously if everybody agrees that the bitcoin is worthless, then it is worthless. But that's a separate topic.
Okay, fine. Everyone involved** agrees that mining the next block is valuable.
Same with all money. Please research more before parroting this argument. You are not the first person to think of it.