wouldn't there be a way to improve BTC's algorithm to consider a large and fast variation of its hashrate (maybe with an average time of the last 50 blocks or any suitable system), some kind of security system to prepare BTC to fight against any eventuality.
Such major change in the consensus rules that is also not backward compatible requires a hard fork. We are never going to have a hard fork for something that is highly unlikely to happen.
It seems that Ukraine has been without electricity for a few days and we can see a quite big variation in the hashrate of BTC since November 22nd,
Hashrate is mainly affected by the price. So any change you see is because of the highly volatile market and the huge market crash that we have had ever since the start of this war (from $70k to $16k).
imagine a situation where Europe and USA would be deprived of electricity and that would cause a big problem in the hashrate.
Not that much hashrate is located in Europe specially this year since electricity price has been shooting up.
As for US the same arguments apply, there is only a portion of the hashrate in US not all of it and not a significant percentage. And they are spread across USA and they use various electricity sources that includes for example solar power (that is not a grid to go down).