A major issue with your thought experiment is that, in your two scenarios, you seem to be making two different and contradictory assumptions about the rigidity of the box (and/or the compressibility of the fluid).
In your first scenario, you seem to be implicitly assuming that the walls of the box (and the pipe) are perfectly rigid. If the top and sides of the box can deform even a little bit under the enormous pressure of the 1 km column of water, they'll flex outwards and expand the volume of the box until most of the water in the pipe (of which there is only one liter) has flowed into the box, drastically reducing the pressure.
In your second scenario, however, your reasoning only works if the box is not perfectly rigid. If it was, the weight of the pipe on top would be supported fully by the box, and none of it would be transferred into the water inside the box. Instead, you seem to be assuming that the top of the box is effectively floating on the water inside, so that the full weight of the pipe is transferred to the water.
Furthermore, if the box was perfectly rigid, fully closed and filled with incompressible fluid, the pressure inside in scenario 2 would actually be indeterminate! You can see this by observing that, since the box is rigid and the fluid incompressible, we can fill the box with fluid to any pressure before sealing it, and the volume of fluid inside the box will be the same! Thus, under these assumptions, just knowing the shape of the box and the amount of fluid inside is not enough to determine the pressure.
Obviously that's not a physically meaningful scenario, but we can regard it as an approximation of a situation where the box is almost rigid and/or the fluid almost incompressible.
In particular, let's assume that there's a valve at the top of the box, where the pipe will connect, which we can open and close at will.
We will first remove the pipe and pour water in through the top valve until the box is full of water and the pressure at the top of the box equals ambient pressure. As you've calculated, the pressure at the bottom of the box will then be (ambient pressure plus) 9.81 kPa, i.e. the pressure under one meter of water.
If we now close the valve, the pressure inside the box will not change. Now we plug in the 1 km × 1 mm² pipe into the (closed) valve and fill that with water too.
The pressure at the bottom of the pipe (above the closed valve) will now be 9.81 MPa. (We assume the pipe and the valve somehow withstand this pressure.) The only thing that has changed below the valve, however, is that there's now an extra 1 kg weight of water (plus the weight of the empty pipe itself, which realistically would of course be way more than 1 kg) resting on top of the box.
Since we assumed the box to be almost perfectly rigid, we can assume that the box will support most of this weight by itself, and thus the pressure of the water inside should not appreciably change. However, even if the entire weight of the water column was somehow transferred through the top of the box to the water below — maybe the "top" is actually a piston supported by the water below, but otherwise free to slide up and down? — that would still only increase the pressure inside the box by 9.81 Pa, i.e. from 9.81 to 9.81981 ≈ 9.82 kPa.
Now let's open the valve. What happens?
If the top of the box was actually a floating piston (of negligible mass, just like the pipe), what would happen is that the liter of water in the pipe would simply drain into the box, while the piston would rise by 1 mm to accommodate it. The pressure at the bottom of the box would still be 9.82 kPa just like before opening the valve.
However, let's go back to our initial assumption of a nearly rigid box. When the valve is opened, the 9.81 MPa pressure at the bottom of the pipe is now transferred to the water in the box, and through it to the sides of the box. That's a lot of pressure pushing the sides outwards, and since they're only almost rigid, they'll still deform a little. And they only need to move a fraction of a millimeter for the box to expand enough to fit the extra liter of water from the pipe.
Even if the walls of the box were really rigid, and could withstand a pressure of nearly 10 MPa without moving even a fraction of a millimeter, the water in the box is only nearly incompressible. The bulk modulus of water is around 2.2 GPa, so at a pressure of 10 MPa the volume of water decreases by about 0.45%. Since the volume of the pipe is only 0.1% of the volume of the box, however, that's more than enough for all the water in the pipe to fit into the box even without the walls flexing at all.
Of course, as water drains out of the pipe and into the box, the pressure in the box will drop until the system attains an equilibrium, with a pressure at the bottom of the box somewhere strictly between 9.82 kPa and 9.82 MPa.
The exact equilibrium pressure depends on the rigidity of the box and the compressibility of the fluid in it. Assuming a perfectly rigid box and a bulk modulus of 2.2 GPa for water, we can in fact calculate the equilibrium height of the water column as about 180 m, with a pressure at the bottom of about 1.8 MPa, which is enough to compress the volume of the water in the box by about 0.08%, or just enough to accommodate the extra 820 ml of water drained from the pipe.
Ps. What if we now close the valve again?
The pressure on both sides of the valve is now the same, so nothing really changes. The box still contains approximately a cubic meter of water under high pressure (up to 1.8 MPa, which is a lot, but nowhere near the 9.8 MPa we'd get for the open-valve equilibrium pressure if we assumed the water to be perfectly incompressible and the box perfectly rigid), while the pipe still has enough water in it to maintain the same pressure on the other side of the valve (i.e. a column about 180 m high, which is also a lot, but nowhere near 1 km).