Let \( c \) represent the container's capacity. The objective is to determine the milk remaining after two separate withdrawals of 9 liters each.
The milk remaining after the initial 9 liters are removed is:
\[ \left( c \times \left( c - \frac{9}{c} \right) \right) \]
The milk remaining after the subsequent 9 liters are removed is:
\[ \left( c \times \left( c - \frac{9}{c} \right) \times \left( c - \frac{9}{c} \right) \right) \]
Post-withdrawal, the milk-to-water ratio is 16:9. This implies the fraction of milk in the container is:
\[ \frac{16}{25} \]
The equation representing the remaining milk in terms of \( c \) is:
\[ \frac{c \times \left( \frac{c-9}{c} \right)^2}{c} = \frac{16}{25} \]
\[ \left( c - \frac{9}{c} \right)^2 = \frac{16}{25} \] Upon taking the square root of both sides:
\[ c - \frac{9}{c} = \frac{4}{5} \]
\[ c - \frac{9}{c} = 1 \quad \Rightarrow \quad c = 45 \]
The container's capacity is \( \boxed{45} \) liters.