I've approached this question by looking at the General Election before each party leader attained their post, for Westminster party leaders of the Lib Dem, Labour, & Conservative parties selected since the 1992 GE. I then look at the distribution of 'percentage majority' among MPs of the same party, and find the percentile in which the leader appeared. After collating these results, I have then tested the null hypothesis that the percentiles come from a uniform distribution - i.e. that majority compared to the rest of one's party has no correlation with election as leader.
For example, to get Boris Johnson's score, I look at the distribution of Conservative MP's percentage majorities in the 2017 General Election. I then find the percentile score of his ~10% majority, approximately 23.3.

The results are below:
Name GE percentile
Tim Farron 2015 2.155172
Boris Johnson 2017 23.343849
Michael Howard 2001 38.554217
Charles Kennedy 1997 47.826087
Iain Duncan Smith 2001 48.192771
Ed Miliband 2010 70.041322
Tony Blair 1992 70.848708
Vince Cable 2017 75.000000
Theresa May 2015 78.879310
David Cameron 2005 81.818182
Nick Clegg 2005 83.870968
Keir Starmer 2019 85.148515
William Hague 1997 85.454545
John Smith 1992 88.191882
Jo Swinson 2017 91.666667
Jeremy Corbyn 2015 91.810345
Gordon Brown 2005 92.394366
Menzies Campbell 2005 96.774194
A Kolmogorov–Smirnov test of these percentiles against a uniform 0-100 distribution gives a p-value of ~ 0.002, so we can reject the hypothesis that 'safe-ness of seat' compared to the rest of one's party has no correlation with selection as party leader. This is illustrated quite nicely by the box-plot below:

These results suggest that party leaders are typically drawn from safe seats. Of course, correlation doesn't necessarily mean causation; MPs could hold large majorities due to their own personal qualities, which also make them successful leadership candidates. Note also that just because a seat is safe compared to the rest of one's party, it doesn't mean that it is safe in general - notably, Jo Swinson had a seat in the 91st percentile of safe-ness compared to her party, but then lost her seat in the 2019 GE.