Given the low cost and ubiquity of sensors nowadays, you'd think it would be feasible to require car makers to test emissions in real time, in the real world.
Besides error codes, OBDII has 8 emissions monitors. In California all cars after 2001 are checked by means of a visual and these 8 readiness monitors: catalyst, heated catalyst, EVAP, SAI, O2, O2 Heater, EGR/VVT, AC
If you need to, you can beat most O2 monitors with a 555, most O2 heater monitors with a $0.45 resistor (or an O2 heater from a neutered O2 sensor), an EGR sensor monitor with a diode and couple resistors. Many catalyst monitors are just downstream O2 sensors that detect cycling (another 555 will defeat).
OBD2 monitoring, without fairly careful visual inspection, isn't a full solution. It's used because it's cheap, easy, and close to good enough, but enthusiasts are easily able to defeat it, for "off road use only", of course...
Until recently O2 sensors were not used on diesels. There are a host of reasons for this, one of the main ones being that until recently, diesel fuel in most places had high levels of sulfur, which is a known poison for Pt and some of the other metals which are used in both catalysts and O2 sensors.
As for EGR monitoring, most OBD2 systems I've seen monitor the presence of the egr solenoid by looking for the back emf. So you'd need an inductor or a solenoid for that. Additionally, they usually will often do a test of the manifold pressure while cycling the valve, to confirm the flow rate (obviously this can only be done of the engine in question has a MAP sensor). And if the MAP sensor is the primary sensor for doing fuel monitoring (ie, no MAF sensor), then there would be no easy way of defeating this monitor without messing up the normal performance of the engine. So in my experience, defeating EGR and passing the EGR related OBD2 monitors is non trivial. But then, since there is usually an allowance (in the current CA smog check schemes) for some of the monitors to not have completed running while still passing the test, it doesn't matter too much in practice (can't disconnect the EGR valve, but the egr readiness monitor is moot). The EGR monitor is usually the last one to run anyway, so this makes passing the smog check with what would otherwise be a egr related OBD2 failure, fairly easy.
Beating O2 monitors is actually much more difficult in practice. First of all, an increasing number of O2 sensors in cars are wideband sensors which don't output the traditional switching signal one could simulate with a 555. Even some older cars use wideband O2 sensors (I have personal experience with two MY 1998 Toyotas [california cars] for which this is the case). Secondly, even if you do have all narrowband O2 sensors on a car, the way the O2 monitors work is that the downstream (of the catalyst) O2 sensor(s) output is compared to the upstream (of the catalyst) O2 sensor(s) to see, not whether the O2 sensor is working, but that the catalyst efficiency is above some threshold. Simply simulating one or both signals with a naive switching circuit will trip the catalyst efficiency monitor. And why would you want to disable the upstream O2 sensor(s) anyway, it's main job is to provide an error signal to the fuel system which would otherwise be a completely open loop system? Without a working feedback loop your fuel system won't be running very well, and usually falls back to a super conservative fuel mapping because of the danger of unknowingly running lean (obviously a concern for gas engines only, not diesels).
Defeating OBD2 monitoring in these sorts of ways is not an issue in any meaningful sense. Enthusiasts often will replace their ECUs wholesale with an aftermarket one. When the ecu hardware and its programming is completely outside of the manufacturer's control, who can say anything about the validity of it's outputs for emissions compliance purposes?
EGR back EMF is simulated with a resistor bridge (for the "EGR not engaged" signal) and a diode to alter the effective resistor bridge (for the "EGR engaged").
Agree that it's totally counterproductive to remove an upstream O2 sensor for a road application. (For an off-road application, the only reason is to allow the use of TEL (leaded) fuel additive as an octane booster and an open loop controller and any such application would drive so few miles per year that it doesn't need to be worried about. The reason to eliminate a downstream is to remove (or dramatically reduce) the catalyst function. I have not experienced a car that did a "compare downstream to upstream"; I'm sure they exist, but manufacturers have an incentive to reduce nuisance MILs, so most controllers are designed to detect gross defects and typical failure modes of installed components, assuming all specified parts are installed, not to detect all possible types of intentional tampering.
I agree with you that this isn't a significant issue in terms of pollution levels, as the enthusiast market that will mod their cars to this extent isn't large in numbers, but based on the amount of poorly modified cars I see (gassers with tailpipes so sooted up they look like diesels, diesels modified so they can better "roll coal", people who think "more fuel must be better" when changing ECU maps, etc), I wonder how many regular cars' emissions are equally by some of these poorly modded enthusiast cars.
(I love and have no philosophical objection to auto enthusiasts and modded cars. Despite my hands-on experience above, I now drive an electric LEAF, which is not exactly an enthusiast car, but does payback the environment for some of my youthful transgressions...)