It sounds like you’re using both Mylio and iCloud photo library on your devices, which tends to creates the issues you’re referring to: either duplicates (because iCloud is syncing photos from your devices) or unpredictability (because your iMac Photos library might not actually have the files locally - Mylio can not retrieve originals from iCloud).
Few ways you can proceed:
1 - stop using iCloud Photo library and let Mylio be the only syncing mechanism
2 - Choose to only import into Mylio from your Phone, and add other photo sources (like cameras or scans) directly into Mylio (in other words, don’t use Apple Photos on your iMac with Mylio)
3 - What you did, which is only sync with your iMac Apple Photos library, but turn the Download originals to this Mac option on in your Apple Photos preferences (this will start putting originals in your Apple Photos library which is typically stored in your internal drive, so thread carefully there as you might start filling up your drive).
I personally use option 1 and don’t rely on iCloud for any of my photos, it works really well. Still use iCloud for document or other files.
Feel free to email email@example.com if you’d like help setting up any of the above scenarios.