MAINT: Refactor numpy/polynomial/_polybase.py

1) Clean up the code and move repeated snippet to a method.
2) Remove use of has_sametype, has_samewindow, has_samedomain. I would
   like to deprecate those methods.
3) Fix error in __truediv__, and make it only allow non-boolean numbers
   for the denominator.

Closes #4631.
BUG: Fix __truediv__ bug in polytemplate.py file.

The use of polytemplate is deprecated, this fix is only for a backport
if needed.
TST: Add tests for the polynomial classes true division.