As Josephs stated, this is probably not a good idea for a large document.
But, as I mentioned in the comments, you can use the environ
package to collect the \BODY
of the document starting \AtBeginDocument
through to \AtEndDocument
. Then, this \BODY
can be passed to the desired macro.
The following applies the macro \ApplyToEntireDocument
which simply applies \textcolor{red}{}
to the entire document.

If possible, it would be better to apply the desired changes within the environment as opposed to calling yet another macro.
Code:
\documentclass{article}
\usepackage{etoolbox}
\usepackage{xcolor}
\usepackage{environ}
\newcommand{\ApplyToEntireDocument}[1]{\textcolor{red}{#1}}
\NewEnviron{CollectBody}{%
\ApplyToEntireDocument{\BODY}%
}%
\AtBeginDocument{\CollectBody}
\AtEndDocument{\endCollectBody}
\begin{document}
This is the start of the document.
Here is a well know equation:
\[
E = mc^2
\]
And another paragraph.
\end{document}
\AtBeginDocument
. See for instance How to automatically add text immediately after \begin{document}. – Peter Grill Dec 29 '12 at 2:26\AtBeginDocument{\demo{}
paired with\AtEndDocument{}}
does not work due to the syntax. – Кигава Енсеи Dec 29 '12 at 6:00