'apt-get source' has been here for a while.
Debian also has now 'debcheckout', but this is more for the package maintainer's version
control system.
You can certainly build your own package and install it. apt considers also locally-installed
packages.