If you change the identity of the application pool, and the new account is not the System account, what account is used when calling SPSecurity.RunWithElevatedPrivileges?
SPSecurity.RunWithElevatedPrivileges reverts to the identity of the application pool (among other things). So, the code runs under the new identity you specified.
Also, if you did change the app pool's identity property (i.e. from the Central Administration Tool, so SharePoint sets correct permissions on the content DB + propagate changes to all servers in the farm) it is now the "new" System Account.
SPSecurity.RunWithElevatedPrivileges always executes the code under Application Pool Identity. So you must ensure that Application Pool Identity has proper permissions over site, otherwise you will get access denied error.