In combat, expending a 3rd-level slot, to stop an opponent's spell of 3rd level or less, seems balanced to me.
For traps and so forth, if I were setting magical traps and expected foes to be using ritual Detect Magic... then I'd want multi-layered defense: dispelling Trap A in the first room, activates Trap B, located elsewhere, perhaps to flood the first room with poison. Ideally, it would trigger *multiple* other traps, to swamp the intruders with harmful effects faster than they can expend their Dispels, their poison-protection, and so forth. But that's putting a LOT of resources into trapping. Also, ritual casting of Detect Magic takes time, and nonritual casting is gonna burn slots quickly.
Hm, maybe an alarm that goes off when an intruder casts Detect Magic... if the intruders start casting ritual DM at the outer areas of my lair, then they're probably spending minutes in each room as they move inwards... there must be a way to use that time to prepare.