Over the years, loads of teams have won the Champions League while they’ve been inconsistent in the league.
Chelsea have won it twice in the last decade: in 2011-12 they won it while finishing 6th (25 points behind the Prem winners) and in 2020-21 while finishing 4th (19 points behind the Prem winners).
Liverpool won it in 2004-05 when they finished 5th (37 points behind the Prem winners).
The last five times Real Madrid have won the Champions League, they’ve finished 3rd, 2nd, 1st, 3rd, 1st in the league. 3/5 times they didn’t win the league as well.