When do you get better weapons?

The more enemies that have died, the better the weapons. This includes bosses, shrine enemies and enemies that die even if you don't kill them e.g. enemies that die by falling from high heights or into water.

As more enemies die, the types of weapons improve, they are more likely to receive modifiers, and the modifiers are more likely to be stronger (for example the attacker modifier will give more attack). This affects weapons dropped by enemies, some but not all treasure chests and amiibos.

Modifiers for attack, durability, long throw, quick shot and shield strength are normally based on a min and max range that increase with more enemy deaths. Amiibos are usually more likely to have stronger modifiers as they only use the max range value. Exceptions are quick shot which uses min value only for amiibo items, shield durability which uses one parameter shared for both amiibo and non-amiibo items, the multi-shot burst modifier for multi-shot burst bows which is always an upgrade from 3-shot to 5-shot burst, and the critical hit modifier which remains unchanged with scaling. Interestingly, if the enemy death count is high enough, the critical hit modifier can no longer be obtained.

Weapons that were purchased from a shop, and weapons from some specific chests, don't improve and cannot receive modifiers.

Source is Zelda mods wiki. It's complex but comprehensive.