There isn't a death certificate as statutory civil registration in Scotland did not begin until 1855.
Are you sure that this is really the John Campbell you are looking for?
www.scotlandspeople.gov.uk gives the date of the marriage of John Campbell and Catherine Horn as 1778, not 1788.
The 1839 death/burial record indexed at
www.scotlandspeople.gov.uk gives John Campbell's age as 66. If this is accurate, it means that he was born in 1772/1773, therefore he cannot possibly be the husband of Catherine Horn, as he was at most six years old in 1778.
Have you looked at the original marriage record, and at the baptisms records of the children of John Campbell and Catherine Horn (Catherine b 1778 and Duncan b 1872) to see if there are any clues, such as witnesses' names, that might provide a clue to their parentage? Also, what additional information (if any) does the original death/burial record contain?
This is now pure
speculation, but I note that there is a baptism of John, son of Duncan Campbell and Janet Macnaughton, in Dunfermline in 1761. If that was an infant baptism, he's still a bit young to marry in 1778, but it's not impossible.