We still don't know if P = NP. You seem peculiarly certain it is, which is odd given that most of the people who study the topic strongly suspect otherwise. They could of course be wrong, but what makes you so sure?
Assuming P != NP we still don't have any proof that sha-2 etc can't be reversed (obviously there is a loss of data). It's implausible for now but someday I guarantee we will have the math that makes it trivial. It does not require P = NP.
That is not necessarily how this works. The only thing required to happen is that a super-majority of the miners running the bitcoin software voluntarily update to a new version. This is how changes have been done to BTC before.