Charles Leclerc overcame a late engine swap ahead of qualifying to claim his third ever pole position at home for the Monaco Grand Prix.