Your theory is mostly correct.
- the cap is a cover for a bottle
Yes
- the lid is a cover for a container which is not bottle
Yes
- the lid doesn't have a screw in it. If it has screw, it is called a cap.
No. Jars often have screw tops. That feature isn't relevant.
Coke cans
Soda cans usually have pop-tops, which is arguably a type of lid. It is not a cap.
Standard cans like pinto beans or mandarin oranges have a lid. The lid requires a can opener, or sometimes has a ring to pull it off. Manufacturers in the USA should strongly consider adding those rings more frequently because they are quite convenient.