The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_tkinter _uuid readline
zlib
To find the necessary bits, look in configure.ac and config.log.
This check does not mean that the zlibsystem package is available. It only means that someone was able to compile the copy of Python 2.7.16 that’s on your system, using such a package.
As the linked documentation says: you need to install the dependencies. This is not something that the Python config does for you, it is something you do beforehand. Consider it as similar to installing the compiler, or make.
If you’re on a Debian-family Linux (including Ubuntu), you should be able to sudo apt build-dep python3 to get the necessary packages for compiling Python from source.