The high abundance of lead (and to a lesser extent mercury) compared to gold comes about from their origins in different nucleosynthetic process in different types of stars.
There are three main reasons:
The first is that lead is the final stable element that is built up (mainly) by the s-process. The s-process builds up the abundances of certain heavy elements in stellar interiors through a series of slow (hence "s") neutron captures onto existing elements around the iron-peak, followed by radioactive decays.
The process stops at lead (and bismuth) because there is no way to reach any of the heavier stable elements (U, Th) because the intermediate products (e.g. Po, At, Rn, Fr) are unstable and decay too rapidly to allow any build up of a significant abundance of heavir elements. In fact the terminus of the s-process is dominated by a circular lead-bismuth-polonium cycle, which at equilibrium ends up producing mostly the 206 and 208 isotopes of lead. So you can think of this as a sort-of pile-up process a bit like passengers on a train, where many get off at intermediate stops, the most popular ones being close to the valley of stability where there are magic numbers of protons or neutrons (50, 82, 126) but anyone left on the train has to get off at the last station. $^{208}$Pb is doubly magic, but there are other s-process peaks at $^{88}$Sr, $^{138}$Ba and several isotopes of Sn (with 50 protons).
Mercury is also an element that is produced in some abundance by the s-process, but in contrast, gold is not one of the stations on the s-process train. Most of the gold in the universe is produced by the rapid r-process of neutron capture. Here, in sites with a much higher neutron flux, many neutron captures happen consecutively followed by decays. This is a way to build many heavy elements that would be unreachable by the s-process because the intermediate nuclei are highly unstable. The r-process gets around that by simple fact of having such a high neutron capture rate that the unstable nuclei don't get chance to decay before they encounter another neutron. Gold is certainly one of the more (but not the most) abundant r-process nuclei. The most abundant r-process elements are formed when the rapid neutron capture is paused when the neutrons reach a magic number. This gives the nuclei chance to decay back towards the valley of stability and produces three broad r-process peaks at mass numbers about 10 below the corresponding s-process peak, centred on mass numbers of 80, 130 and 192. But in general the r-process elements are rarer for a reason I explain next.
Contributions of the r- and s-process to elemental abundances in the solar system. (from Sneden & Cowan 2003), note the logarithmic scale).
The second reason lead is common is that the s-process operates in relatively abundant low-mass stars. By low-mass, I mean stars between 1 and a few solar masses, that have had time to be born, live and die in the lifetime of the universe, but will not explode as supernovae. The lead is produced by s-process neutron capture in their interiors during their giant phases and is then expelled through mixing and strong stellar winds into the interstellar medium.
In contrast, the r-process either acts in the interiors of core-collapse supernovae, the final stage of life for more massive stars, or in the ejecta from colliding neutron stars, which themselves are the products of core-collapse supernovae in massive stars. Ultimately gold is produced from massive stars or the remnants of massive stars.
The preponderance of lead over gold is therefore also due to their different stellar origins. Low-mass stars are much more common than high-mass stars. The "stellar birth mass function" goes as something like $n(m) \propto m^{-2.3}$. Therefore we would expect a priori that elements produced in the interiors of low-mass stars would be more common than those in high-mass stars, although of course the production efficiency matters too.
The third reason is that the abundance of lead is continually increased from the other direction by the radioactive decay of heavier elements. Most radioactive elements, including the relatively abundant U and Th have decay routes that lead them to stable lead nuclei. This is not as important as the other two reasons, since the production rate and abundance of these heavier elements is low compared with the abundance of lead produce in the s-process.
It is fair to say that although this basic picture is understood, there is a phenomenal amount of progress to be made in understanding exactly what fraction of each chemical element was made by what process in what type of star(s). This is a highly active research topic and I highly recommend the review by Frebel (2018) as further reading.