Instead, the legislation is prompted by those who form interest groups, and the fine details put together either in writing the law or by the administrative officials from the relevant executive office.
These people get their expertise by having worked in those fields, or knowing others who do.
The alternatives are arguably worse- legislation written by people who genuinely have no idea what they are talking about (which does still happen too often) or government so tiny and limited in scope that it may as well be nothing more than a militia.
As you said it yourself, they can't know the perfect rules for everything - and the reason is that different laws (and their tradeoff when dealing with others) are best for different people.
Private courts and private insurances tending to their customers need could offer a society where different needs are met by different laws. This has been proposed in The Machinery of Freedom.