I initially failed to include my real error (sorry it's my first time). It came from trying to do a nested hyperlink\hyperlink{anchor_a}{\hypertarget{anchor_b}{STUFF}}. I've updated the question. It's probably not supported.
I solved my problem by going off on the tangent and linking the image to a phantom character next to the big version of the image, and then doing the same for the big image. This produces the expected behavior.
\documentclass{article}
% Media
\usepackage{pdfpages}
\usepackage{graphicx}
% Hyperlinks
\usepackage{hyperref}
\begin{document}
% Targets phantom character of small image
\hypertarget{number_b}{
\phantom{} % Makes 0 length character
}
% Links to phantom character of the big image when clicking on the small image
\hyperlink{number_a}{
\includegraphics[width=0.25\textwidth]{number.jpg}
}
\newpage
% Big image phantom
\hypertarget{number_a}{
\phantom{}
}
% Big image
\hyperlink{number_b}{
\includegraphics[width=\textwidth]{number.jpg}
}
\newpage
% Adds all the pages on the document with the pages=- option
\includepdf[pages=-]{number.pdf}
\end{document}
I figured from Using \hyperlink to link text to page with an implicit page anchor not known in advance that it's also possible jump to the page anchor to solve it:
\documentclass{article}
% Media
\usepackage{pdfpages}
\usepackage{graphicx}
% Hyperlinks
\usepackage{hyperref}
\begin{document}
\hyperlink{page.2}{
\includegraphics[width=0.25\textwidth]{number.jpg}
}
\newpage
\hyperlink{page.1}{
\includegraphics[width=\textwidth]{number.jpg}
}
\newpage
% Adds all the pages on the document with the pages=- option
\includepdf[pages=-]{number.pdf}
\end{document}
The problem with this of course is that you have to know the size of the included pdf, and the location of both of the images in the page, so it makes it computationally expensive to include documents programmatically as you have to keep track of the page numbers. It's irrelevant for a few pages but it becomes an issue for anything more than 1000 pages long.
I implemented my solution in this ruby gist that takes an array of arrays as an input [ [first.jpg,first.pdf,first.name],...,[last.jpg,last.pdf,last.name] ] and outputs the phantom solution.