(packaging) (#20148) Clean up the Debian rules file

Improve the use of templates to remove redundant code and improve
consistency.