I have not heard of such a custom myself but it might argued that (if Boswell's attendance was unusual) it was driven by his guilt at not being present for the final stages of her illness and death.

Margaret had not taken to life in London after Boswell's move there from Edinburgh. The city did little for her health or serenity and it was ultimately decided she should move back to Scotland, with James remaining in England.

Upon hearing of Margaret's illness worsening, James raced north as fast as possible but was unable to reach his wife in time - something he deeply regretted for the rest of his life.

No doubt he paid enormous diligence to his duties as a husband after Margaret's death as an attempt to counteract this.