[1.7.x] Fixed #22942 -- Noted that __init__.py files are required for management command detection.

Thanks Diego Cerdán for the suggestion.

Backport of 54546cee88 from master