I would look first at the wiring & connections and fuses. Partially corroded fuses and connections often cause lighting problems ... including the 3 pin plug connectors to the headlamps (often become corroded)
What I do if the PDC looks dirty or corroded, is remove all the fuses in the PDC and clean the cavities using elect. contact cleaner then use small amounts of dialectic grease on the fuse blades, sticking each one back into their fuse receptacle.
If you have OE fog lamps there would be another circuit of concern, as the fogs are tied into the headlamp circuit.
Many of the Cherokees have a headlight delay module this too is tied into the headlamp circuit from underneath the dash panel.
Any auxiliary equipment and/or lighting connected to the OE harness can potentially cause problems. What I do to prevent problems is keep all the aux. equipment on a separate battery circuit and fuse panel.
There are numerous accounts of headlight and instrument panel flickering being caused by the headlamp switch.
Are you running standard wattage headlamps using 35 watt primary power or heavier duty lamps with 55 watt primary power?
55 watt primary bulbs are better designed to be used with a min. 16 gauge wire. Aging 18 gauge OE circuits sometime create excessive voltage drop, causing strange things to happen with relays, switches, wiring, etc.
Even when using standard 35 watt primary bulbs ... voltage drop from age, dirt and corrosion the switches sometimes loose efficiency and become problematic. Wear from use & friction is one reason for switch failure ... Also small amounts of arcing over long periods of use (because of poor wiring & connections) produces excessive electrolysis, causing a switch or relay to wear out and not behave as it should. Symptoms e.g. are flickering, switch or relay works intermittently , etc.
Rather than replacing the switch I might try searching for writeups regarding headlight switch rebuilding or maintenance.
e.g. Writeup fixing the headlight dimmer switch.
or a google search: jeep cherokee rebuild headlight switch