Most lenses tend to be expensive because the lens needs to be very complicated in order to correct for various optical effects (aberration, etc). Is it possible to build a sensor and processor combination which would fix defects produced by cheap lenses? I'm assuming the processor knows exactly the parameters of the len's defects.
Not only is it possible, but it's becoming commonplace. The micro-four-thirds system makes extensive use of it, and some compact cameras now do too. (I imagine that if they don't yet, most super-zooms will within a few years.) Digital Photography Review has a good article on this at http://www.dpreview.com/articles/5653763779/a-distorted-view-in-camera-distortion-correction , and it's worth reading even if you don't like that site's reviews in general.
Correcting distortion and lateral chromatic aberration is an option in my Pentax K-7, but although it doesn't impact shot-to-shot time (unless you fill the buffer), it takes a few extra seconds per image.
There are a limited set of defects that can be corrected in software, lateral chromatic aberration, yes, but not longitudinal chromatic aberration. Lateral CA results in the component colours of light being displaced radially across the sensor. This can be corrected by simply warping each colour channel slightly differently. Longitudinal CA causes out of focus areas near strong lights to be tinted either green of magenta depending on whether they are in front of behind the plane of focus. This is much harder to correct as you need to know 3D information about the scene.
Some cameras are now offering lens corrections based on a database of corrections tailored to each lens. I think these are limited to barrel distortion, lateral CA and vignetting.
You'd think the manufacturers would be the best source of this sort of information but I would image crowd sourcing the parameters on the net would be more effective as there are some very dedicated people around taking that sort of measurement.
If it is possible in post-processing, then technically it can be done in-camera. Some defects are pretty easy to fix - like geometry defects, but other are very hard, if not impossible, to fix in software (soft focus [yes, you can to some extent generate a sharper image, but this is not really reversing the lens imperfection], chromatic aberrations, ghost images or flare due to uncoated elements, etc.).
There are a certain class, like things that can be done in software, but there isn't a magic piece of glass that could be added to a camera to make it perform better.
One thing that might be possible is to have lenses built in 2 part systems. The part closest to the camera might handle the more delicate lens corrections, and the further away part give the right range. Still, something tells me that while this might be possible, it would be more of a pain then it's really worth. Hmmm...
I don't know how many 'cheap' lenses are catalogued, but DXO does a very good job correcting lense-induced faults, in my experience.
As a specific example, I used it to correct pincushioning on architectural photos taken with a Canon EF 28-300 f/3.5-5.6L IS USM at 28mm and the results were impressive (curved walls at the edge became perfectly straight).