Never thought of WD-40. It is more solvent than lubricant, so makes sense for small areas. Concern is there still is some lubricant to it and curious if that attracts and holds debris. That's got to be why you make sure you clean it off so well.
BTW...the pics are of a 25 year old engine bay of a car that actually gets driven. Over 115k miles to-date.