Remember that the area can be that of any surface as long the closed loop defines its edge as shown by the butterfly net diagram below.
Also one must remember that it is the current passing through the butterfly net which must be considered not just the current entering the butterfly net.
So now look at example (a) and example (b) which have the same loop and hence the same integral on the left hand side of ampere's law $B2\pi r$.
In example (a) the butterfly net has been collapsed and is the blue shaded area.
For the right hand side of ampere's law you have to evaluate the total current passing through the butterfly net which is the blue area.
In example (a) it is easy - the current is $I$ and so you get that $B2\pi r = \mu_o I \Rightarrow B= \dfrac{\mu_oI}{2 \pi r}$.
Now look at example (b).
The current passing through the butterfly net (blue area) is zero so $B2\pi r = 0 \Rightarrow B= 0$.
You are evaluating the same magnetic field $B$ at a distance $r$ from the wire on the left hand side of the capacitor so how can you have two different values?
The answer is that you cannot and that is why Maxwell said that there was another type of current passing between the capacitor plates which he called the displacement current.
When you apply amperes law with the displacement current you find that example (b) also predicts that $B= \dfrac{\mu_oI}{2 \pi r}$.
Update in response to a comment from @samjoe
Here is a diagram of a capacitor which is charging with and amperian loop shown in blue and the amperian surface shown in pink.
The area vector is in the same direction as the electric field $\vec E$ and so the positive direction around the loop is anticlockwise looking from the top - blue arrow.
$\displaystyle \oint_{\rm loop} \vec B \cdot d\vec l = \mu_o I_{\rm surface}+ \mu_o\epsilon_o \dfrac {\partial}{\partial t}\left ( \int_{\rm surface} \vec E \cdot d\vec S\right)$
Left hand side
$\displaystyle \oint_{\rm loop} \vec B \cdot d\vec l = 2 \pi r B$
Right hand side
$\mu_o I_{\rm surface} = 0$
For a parallel plate capacitor $E = \dfrac \sigma \epsilon_o$ where $\sigma$ is the surface charge density which is equal to $\dfrac{Q}{\pi R^2}$
$\Rightarrow E = \dfrac{Q}{\epsilon_o \pi R^2} \Rightarrow \displaystyle \int_{\rm surface} \vec E \cdot d\vec S = \dfrac{Q}{\epsilon_o \pi R^2} \pi r^2 = \dfrac{Q r^2}{\epsilon_o R^2}$
$\displaystyle \mu_o\epsilon_o \dfrac {\partial}{\partial t}\left ( \int_{\rm surface} \vec E \cdot d\vec S\right) = \dfrac{\mu_o I r^2}{R^2}$ because $\dfrac{\partial Q}{\partial t}=I$
Equating the left hand side and the right hand side gives a value for the magnetic field at a distance $r$ from the central axis of the capacitor
$B = \dfrac{\mu_oIr}{2\pi R^2}$ for $0\le r\le R$
and with $r=R$ this gives the familiar $B = \dfrac{\mu_oI}{2\pi R}$