Why do we absorb vitamins better from whole foods than from pills?
Why can't we just create a pill that does have all the necessary components?


I'm assuming you mean micronutrients (vitamins &amp; minerals). A day's worth of macronutrients (energy and building-block providing chemicals - proteins, fats, sugars) are already very abundant and dense - a pill containing a day's worth would be the size of an egg. 

Otherwise, we do. There are vitamin/mineral pills which have a very high absorbancy rate (usually those chelated or chemically bonded to various amino acids [words ending in -nate on the label]).

The big problem is that while the vitamins and minerals may satisfy your bare biochemical needs, that is all they do. They will not satisfy a hunger instinct (proteins and fats do that), and there are untold millions of compounds in the untold thousands of plants and products humans can pick up from the market. These compounds usually do not do much, but some are beneficial to our health.

So while multivitamins exist which provide you with a very efficient method of absorbing most of your vitamins and minerals, it's always recommended to get them directly from food since food will provide macronutrients (thus satisfying your hunger), the micronutrients you're curious about, and many potential beneficial compounds which are not necessary.

If you are still interested, Soylent Shakes are an attempt to provide all the micro- and macronutrients the body needs in an easier-to-consume form without all the messy cooking or multivitamin pills. Keep in mind the long-term effects of sticking to such a diet are more or less unknown, but it's as close as we can likely get to an "all-in-one" meal.