Not sure that installs corrupt over time...on that, Channan and I would agree.
And no, Apple doesn't write code to purposely slow down older models, but at the same time they should have halted support on the iPad 2 sooner.
Part of the reason why they didn't was because of 'agreements' Apple made (either implied or otherwise) when the 2 was still actively sold to the private sector, but that's another topic altogether.
There are plenty of examples where an iOS install has to be reinstalled from recovery mode because the installation has corrupted.
They shouldn't have halted support for the iPad 2 - long support cycles are good and have allowed for many people to keep their devices which is good for consumers and also good for keeping iPads usable and thus having a positive environmental effect, however they should have allowed for downgrading for those who wanted it.