You made the same fundamental mistake that Anton Gromov made in his question on the sister Space Exploration StackExchange network site: You used the solar system barycenter rather than the Sun as the frame origin. Had you used the Sun, the apparent discrepancy would have dropped by almost two orders of magnitude.
A much lesser flaw is that you apparently used midnight rather than noon. The J2000.0 epoch is 12 noon Terrestrial Time on 1 January 2000. This doesn't change things by much, but it is nonetheless important. That half day offset has bitten me more than once.
The z coordinate of the Earth's position would not have dropped to zero had you made the above corrections (Sun-centered rather than solar system barycenter, and 12 noon rather than midnight). It would not have dropped to zero even if you had used the Earth-Moon barycenter rather than the center of the Earth.
One reason it would not have dropped to zero is that the Earth's orbit about the Sun is not an ellipse. The Earth's orbit doesn't even lie on a plane! The key cause of this non-planar motion is that the Moon's orbit about the Earth is inclined by about 5.15° with respect to the ecliptic, making the Earth bob up and down with respect to the ecliptic1. Because the Earth's orbit is not truly elliptical or even planar, the ecliptic plane at some epoch is a time-averaged plane centered about the epoch time that makes the Earth's position with respect to the Sun (or the Sun's position with respect to the Earth) average to zero.
A lesser reason is that the J2000.0 mean ecliptic and mean equinox frame was defined over 36 years ago. HORIZONS uses DE431, which was released 6 years ago. JPL's ability to model the solar system improved significantly in the intervening three decades.
1 Strictly speaking, it makes the Sun appear to bob up and down with respect to the ecliptic. The concept of the ecliptic plane dates back to the ancient Greeks, and it retains a vestige of this definition to this day.