Build with modern pyproject macros, fixes #2164207
This uses the pyproject macros to build with flit, instead of
using setuptools or distutils. As well as being simpler, cleaner
and more modern, this also solves #2164207, which was triggered
by a build using distutils because setuptools dropped out of the
dep chain.