In order to understand why you're having these problems, you need to understand the underlying concepts of ownership.
Basically, you know that apache is running as the www-data user. This is why setting everything to be owned by that user works, because WordPress is verifying that it can create files as the user that owns its own files. So, what you're doing is to make everything owned by the user that owns the files.
If you have full and total control of the machine, this is fine. On the other hand, if it's a shared hosting server, then you have created a security hole.
Normally, web servers run as some user (like www-data) which then runs code by other users (like "otto", my user account). In this situation, the webserver would not have the ability to create files as "otto", and thus would not be able to properly create files as my account. Thus, this check by WordPress as to creating properly owned files and thus being able to install plugins or update files would fail, correctly, because having my files owned by the shared webserver user would be a security risk.
In such a case, WordPress should correctly prompt me for FTP credentials, or something to that effect. These would be a way to work around the user account issue by authenticating as the user that should be writing the files, and then writing them as that user.
Now, you're trying to solve this problem by changing all the WordPress files to be owned by the same account that the webserver writes the files as. The more normal approach for this is to change how the webserver writes files, to allow the PHP process to be "owned" by the user account that it is running the files as.
The general answer to this is "suphp". This version of PHP sets the user that the PHP process runs as to the same user as the owner of the PHP files it is running. This is safer on shared hosting setups, because it ensures that a PHP process being run by the shared webserver runs as the owner of the PHP files, and thus can't read other users accounts and the like.
On Ubuntu, I believe this is the general way to do it:
$ sudo apt-get install libapache2-mod-suphp
Disable the old mod_php
$ sudo a2dismod php5
$ sudo /etc/init.d/apache2 restart
And voila. Now, have your WordPress PHP files owned by the Normal owner of them. No special tricks, no changing permissions or ownership or anything like that. Since the PHP process will run as the owner of those files, then it will be able to write to them as that owner. Directories should be 755, files should be 644 (note, suphp doesn't like when files are writable by group, so 755/644 is the correct permission set).