Jesus knew what was in the hearts of human beings and knew that the fear of hell, while not the end point of the Christian life, is a very good beginning if it motivates repentance.
And while “perfect love casts out fear” of punishment and of the Day of Judgment (1 John 4:17-18), the spiritual wisdom of the Church makes clear that we can’t jump to the end of the journey without a good beginning, patiently working through each step of purification and cleansing.
St. Catherine of Siena notes how the initial stage of the journey is characterized by a very useful fear of hell, a “slavish fear,” as she puts it, which later moves on to what she calls “mercenary love” and, finally, on to “perfect love.” You don’t jump to perfect love without a good beginning.
St. John of the Cross presupposes that before people are really ready to undertake the spiritual journey they have been deeply struck by the shortness of life, the narrowness of the road leading to life (Matthew 7:14), the strictness of the judgment, how “the just one is scarcely saved” (1 Peter 4:18), how “perdition is very easy and salvation very difficult” and the need for profound repentance from sin and wholehearted surrender to God (The Spiritual Canticle, Stanza 1;1).
St. Ignatius of Loyola, in his Spiritual Exercises, acknowledges that the most important motivation for serving God is pure love, but he also cites the useful role of “servile fear” in the spiritual journey (as also does St. Francis de Sales)