Let's take example of Bitcoin. Assume all nodes of Bitcoin network go offline for some reason. Now assume an adversary (a party who wants to do harm to Bitcoin) detects the situation and starts mining blocks. Since no one else is mining at that time, the adversary can create selfish (illegal) transactions and include them in his/her blocks. If he is able to build many such blocks on top of each other, when the parties start getting back online, they may have to accept those blocks with selfish transactions (since the longest chain wins). If those blocks are accepted, the adversary has been able to successfully do illegal transactions.
Your explained way to cheat the system is not possible.
There is more than that the longest chain wins, it's actually the
longest valid chain wins. If only the longest chain would win, I could start mining now with a very low difficulty and broadcast new blocks every 5 minutes. I would then have the longest chain and would, in your logic, force all other participants to change to my side of the blockchain, because it's the longest. That's not how it works.
If someone creates transactions or blocks which other nodes don't accept, because they go against the consensus rules, they just ignore those transactions and blocks and also ignore the node which is broadcasting those.
This is how it works at the moment with 100000 of participants, this is how it will work with only 2 participants in the bitcoin network.
The only way to be successful with such an attack is when the attacker change the bitcoin client and change the consensus rules so that his illegal transactions looks like valid transactions and all other participants of the network download this bitcoin client.
If other participants work with the original client and original consensus rules the only thing what happens is, that the attacker creates a fork of the blockchain with illegal transactions and blocks. All other will just ignore this side of the fork and continue on the other valid side of the fork.
So it's actually a dump way to cheat in this way.
If you are the only one left in the network you could just start mining normal and valid blocks and be happy with the block reward and hope that the coin is coming back alive after some time to be able to sell those coins. But it depends with which difficulty the last block was mined. If it was too high, you might not be able to mine any block within a reasonable time frame. Difficulty adjustments in Bitcoin only happens after 2016 mined blocks. So it's possible you are not able to mine those much blocks to reduce the difficulty.
Then the only way to bring the blockchain back to life would be a hardfork to change the difficulty adjustment. But then again, if other nodes start to join the network again, they will see your blocks as invalid unless they also update to your new client with new difficulty adjustment.
How he can to start mining if he does not have previous blocks?
This will be just a new blockchain.
In the example of Bitcoin there are currently a lot of full nodes which have the full blockchain saved. So even if all nodes go offline that does not mean that everyone is deleting the blockchain.
In the best case someone who want to continue mining already have the previous blocks. If not he might find someone who did run a full node in the past and get the blocks from this person.