Where'd 2040 come from?
And assuming we do get that technological advancement, naturally the current state of Bitcoin wouldn't stand up against it lol. Hardly any existing system that uses the current level of algorithms that we have would. Granted it's the "current". Technological advancements don't only happen one-sidedly, everything goes up, even the algorithms people use for hashing, including the ones we use in crypto (and many others). It shouldn't be a problem imo, unless all the current repo maintainers suddenly went out of existence.
Also, I wouldn't worry about Bitcoin really. Before anything else, we'd probably see some sort of mayhem in the world first before that (Assuming everything stagnated). At that point I don't think Bitcoin being affected by QC would matter at all.
The pace will matter ,while if any "bad" person gets a "super" computer, as in something that can crack into anything with brute force of a few hours or even days, then this is not just bad for bitcoin, think of nuclear codes, think of all the sensitive information in all secret agencies around the world, think of all state top secret briefs, these are just the political parts.
What about company secrets? We will certainly learn what KFC crust is made of lol. So all in all, I believe you are right, we need to have the defense ready when something like this happens, which is why it will improve from both sides at the same time, this way if anyone has super computer, then we would have a defense against super computer and it would not change anything for security reasons. Bitcoin will be ready for it when the time comes, there isn't any proof of risk just yet, so we do not have to worry about this yet, we can take our time and not really care about advancements just yet.