You are also missing the human element. Ignoring all other safeguards*, if a chain "better" than the current one appeared suddenly, a lot of people would notice, and nobody would believe the new chain to be the correct one. Bitcoin Core would quickly be updated to blacklist the new chain.
* Bitcoin Core currently has several checkpoints for blocks it expects in the current chain. The last checkpoint is from 2022, so if you want to fool the latest Bitcoin Core, you have to start your work from that point.