The problem is not with desktop wallets, the problem is with your environment. For example if you are using windows and connect to the internet with it, there is a good chance that it gets infected with some sort of malware/keylogger and when you use a bitcoin wallet you can lose your funds (among other risks).
This is why the term "hot wallet" exists. The solution is to use "cold storage" and only use your hot wallet for small amounts.
Cold storage is basically an air-gap system that has never been connected to the outside world (through the internet or otherwise) and never will connect. You can use a dedicated system (like an old laptop) or use a secondary OS (even live Linux).
Another way is to buy a hardware wallet and make things simple on yourself.
https://electrum.readthedocs.io/en/latest/coldstorage.html