Thanks for writing in.
The dashboard and media page has no direct integration with the theme or cornerstone. Most of the resources from the theme and cornerstone are only loaded when called on a page. It could be due to other plugins that are active upon load regardless of page, you could try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.
You may also check this article https://www.lifewire.com/504-gateway-timeout-error-explained-2622941 especially this area
Fixing 504 Errors on Your Own Site
A lot of times this isn't your fault at all, but it's not the user's either.
Start by checking that your server can properly resolve all the domains that your applications require access to.
Very heavy traffic might result in your server serving a 504 error, even though a 503 would probably be a bit more accurate.
In WordPress specifically, 504: Gateway Timeout messages are sometimes due to corrupted databases. Install WP-DBManager and then try the “Repair DB” feature, followed by “Optimize DB,” and see if that helps.
Also, make sure your HTACCESS file is correct, especially if you have just reinstalled WordPress.
Finally, consider contacting your hosting company. It’s possible that the 504 error that your website is returning is due to an issue on their end that they’ll need to resolve.
Let us know how it goes!