Rev 3:19 As many as I love, I rebuke and chasten: be zealous therefore, and repent.
Jesus saved His strongest rebuke for the church of Laodicea. He had no commendation for them and plenty of condemnation. Still, they were His children, it was His church and He had this to say to them, “I love you, therefore I am taking you out behind the woodshed.”
Parents are not supposed to discipline other people's children. But they have need of taking care of their own. So it is with the Heavenly Father. The Devil’s kids will be punished, but not chastised by the Lord. If we find ourselves being spanked by the Lord, we are blessed to know it is because we belong to Him and are loved by Him.
The writer of Hebrews is careful to explain this parental care of the Father:
Heb 12:5 And ye have forgotten the exhortation which speaketh unto you as unto children, My son, despise not thou the chastening of the Lord, nor faint when thou art rebuked of him: 6 For whom the Lord loveth he chasteneth, and scourgeth every son whom he receiveth. 7 If ye endure chastening, God dealeth with you as with sons; for what son is he whom the father chasteneth not? 8 But if ye be without chastisement, whereof all are partakers, then are ye bastards, and not sons. 9 Furthermore we have had fathers of our flesh which corrected us, and we gave them reverence: shall we not much rather be in subjection unto the Father of spirits, and live? 10 For they verily for a few days chastened us after their own pleasure; but he for our profit, that we might be partakers of his holiness. 11 Now no chastening for the present seemeth to be joyous, but grievous: nevertheless afterward it yieldeth the peaceable fruit of righteousness unto them which are exercised thereby.
In short, when we find ourselves being rebuked or corrected by the Lord, it is because He is our Lord and cares enough to ensure that we learn from our mistakes.