To prevent an issue like this, Apple users should change their Apple ID passwords, enable two-factor authentication, and never use the same password twice. Products like 1Password, LastPass, and even Apple's own iCloud Keychain are ideal ways to generate and store new passwords for each and every website.
There is 2 major flaws in the way the iCloud system is designed:
First the easy access to the 'Find My Phone'. It's logical to have access to this function without the 2-factor authentication, because if the thief is able to access it before you do, he/she could be able to block you from locking the device. But there should be an additional step before allowing the device to be locked, e.g. an additional personal question or entering the device password.
Two, and this one is a huge flaw: There is no 2-factor authentication when you are setting up an iCloud account on a Mac with iCloud panel in the System Preferences. Even if it's activated in your iCloud account. Just after a few simple steps, you're Mac is entitled to receive the 2-factor authentication notifications without further process.