I'm currently reading Munkres' book (for the second time, as I didn't finish it the last time around). Did you ever come to a resolution on this mystery?
I agree with you that this definition is a bit weird. As mentioned above, the definition of a function needs two pieces of data in order to talk about the notion of topology (amongst other things). These data are: (1) a set of ordered pairs, and (2) a codomain. The domain is less important to explicitly specify because it can be given by the first coordinates of the set of ordered pairs. It feels to me that the most concise way of definition a function is the way we have all seen before:
Definition. Let $A$ and $B$ be sets. We say that a set of ordered pairs $f\subseteq A\times B$ is a function from $A$ to $B$ if for all $a\in A$ there exists a unique $b\in B$ such that $(a,b)\in f$. We write $f:A\rightarrow B$ to mean that $f$ is a function from $A$ to $B$.
Definition. Let $f:A\rightarrow B$. We say that the set $A$ is the domain of $f$ and that the set $B$ is the codomain of $f$, which we denote by $\text{dom}(f)$ and $\text{codom}(f)$, respectively. The image of $f$ is defined as the set $$\text{image}(f) := \{b\in B\,:\, \exists a\in A\text{ s.t. } (a,b)\in f\}.$$
These definitions are all that we need. Furthermore, in my personal opinion, these definitions makes it more clear as to what the primitive notions of a function are.
As you mentioned, it is strange that Munkres starts with these sets $C$ and $D$ (and a rule of assignment) as primitives, then shrinks them both (to the domain and image, respectively, of the rule of assignment), then takes $B$ as a another primitive object (which depends on the rule of assignment's image), and uses all this to define the function. It seems like he is working too hard to define a function from $A$ to $B$.
One possible explanation for this approach is if the concept of a "rule of assignment" were to be used later. But I don't think it is (nor have I seen this concept in other settings). If it was, then perhaps it makes sense to start there and define a function from that notion. Of course, a rule of assignment is, in some sense, a weaker notion that that of a function (in that there may be elements of the set $C$ that do not appear as first coordinates in the rule of assignment). Maybe Munkres liked the idea of starting from this as opposed to immediately starting with the stronger notion of a function? I.e., show how this weaker notion, along with the primitive $B$, gives us a function. But then never use it again...
Something I do appreciate, however, from Munkres' approach is that he is careful about specifying the codomain. In many real and complex analysis books, for example, statements about the continuity, measurability, etc of functions are stated without explicit mention of what the codomain is. For example, when studying indicator functions, is it's codomain the set $\{0,1\}$ or the set $\mathbb{R}$ or the set $\mathbb{R} \setminus \{\pi,17\}$ or the set $\mathbb{R}\cup \{\pm\infty\}$ or the set $\mathbb{C}$, etc? Now, under the usual topology, $\sigma$-algebra, etc on these spaces (and the resulting subspace topologies and sub-$\sigma$-algebras, etc) continuity or measurability of the function with a codomain containing it's image set implies the continuity or measurability of the function with any other codomain containing it's image set. So in that sense, sometimes it is innocuous to fail to explicitly mention what "universe" is being operated in. Regardless, it is refreshing to have a book like the one Munkres wrote where he is very clear, from the onset, what the various sets are so that there is no confusion.