IMO, modern sensors paired with robot controlled guns are one of the most promising hard kill solutions for drone combat. Gepard and the newer Skyranger 30 have proven themselves against low-spec threats in Ukraine. C-RAM (aka Land Phalanx Weapon System) is an already deployed system that is very effective against even higher spec threats like missiles.
Of course, there are always tradeoffs. Even the best guns have much shorter ranges than air defense missiles, and that means you need more systems to provide the same area coverage. As you mentioned, the guns themselves (and the sensors and networks feeding them) become a target.
As usual though, likely the solution will require a mix of capabilities across the spectrum, working to cover each others' weaknesses. Nothing is fool-proof, but all can force costly adaptations. Take EW for example. Nothing is cheaper than jamming out the drone's comms or nav. This forces adaptation to autonomy or fiber optic drones, which have their own costs, supply pinch points (Russia now consumes somewhere around 10% of the world's fiber, for example), and tradeoffs.
This is nothing new - layered air defense has been around a long time. The new thing is the explosion of cheap, low-spec threats forcing development of a cheap and sustainable answer to them.
Nets, EW, beam weapons, gun systems, interceptor drones, AMRAAM, Patriot, SAMP/T, etc etc... all fill an important role in targeting different threats.