Very nice question, I learnt something new when trying to answer it. First of all, there's a slight problem with your equation, it should read
$$\nabla \times \mathbf{B} = \mu_0 \mathbf{j}$$
where $\mathbf{j}$ is the current density, and I've ignored the term containing the changing electric field since we're dealing with magnetostatics. As you rightly point out,
$$\mathbf{B} = \frac{\mu_0 I}{2 \pi r}\mathbf{\hat{\phi}}.$$
The standard way to solve this problem is to go to the integral form of the given Maxwell Equation, so that:
$$\nabla \times \mathbf{B} = \mu_0\mathbf{j} \quad \quad \longrightarrow \quad \quad \oint_C \mathbf{B}\cdot \text{d}\mathbf{l} = \mu_0 \iint \mathbf{j}\cdot \text{d}\mathbf{A} = \mu_0 I,$$
and it's trivial to verify that this does indeed give you a consistent answer.
However, what if you want to do it directly using Maxwell's Equation? You should be a little concerned, since a current density appears on the right hand side. But what is the current density for a wire carrying a current $I$? Well, naively you'd want to divide the current by the cross-sectional area of the wire. But our wire is just a point, and so we'd get a nonsensical answer using our naive technique!
This is completely analogous to the case where one tries to apply Gauss's law in its differential form to a single point charge. There to the "densities" blow up and you need to stop thinking in terms of "functions" but rather in terms of distributions. In such cases, the Dirac delta function often appears, since our densities need to be:
- Zero everywhere apart from a point where it isn't well defined, and
- Finite when we integrate over all space.
The $\delta-$function satisfies these conditions. (This is not a proof! It's barely a motivation, frankly. Proving this is a mathematical exercise, and can get a little hairy.)
However, let's see what happens if we plug our $\mathbf{B}$ into the curl equation:
$$\nabla \times \mathbf{B} = \mathbf{\hat{z}} \frac{1}{r}\frac{\partial}{\partial r} \Big(r B_\phi\Big) = \mathbf{\hat{z}}\frac{1}{r} \frac{\partial}{\partial r}\Big(\text{constant}\Big) = 0 \quad \forall\,\, r \neq 0.$$
The important thing to realise is that as $r\to 0$, the above quantity is of the $\frac{0}{0}$ form, and therefore is not defined. The curl is zero everywhere except "at" the wire which is positioned at $r=0$. (This should make intuitive sense too, the current density is zero everywhere except on the wire, where it is infinite.)
There's a mathematical identity which (if I remember correctly) says that in cylindrical coordinates $$\nabla \times \frac{\hat{\phi}}{r} = \mathbf{\hat{z}} \,\,2\pi \delta^2(r),$$
where $\delta^2(r) = \delta(x)\delta(y)$ is the 2D $\delta-$function. Using this, you can show that $$\nabla \times \mathbf{B} = \mathbf{\hat{z}}\mu_0 I\, \delta^2(r).$$
The right hand side is always zero unless $r=0$ (which is what we saw should be the case by actually calculating the curl), but the value at $r=0$ is infinite (as we would expect intuitively). In other words the current density of an infinite wire pointing along $z$ is $\mathbf{j} = \mathbf{\hat{z}} \,\, I\delta^2(r).$