Jihad organizations rarely have a purely military focus. They always have used charities and created Islamist schools to recruit new members, and those "wings" require their own procedures and people. Similarly, the larger ones also need to speak to the media and negotiate with other groups, and those people become the "political wings" of the organizations.
The critical point is that the political and social-service wings are not separate - their entire existence is to support the terrorist goals of the organization. They are subservient to the military goals, not independent of them.
For example, here are some pictures from Palestine Today showing a leader of the "political wing" of Islamic Jihad, Sheikh Nafez Azzam, greeting the backbone of the terror organization:
He reiterated that armed "resistance" is the only way to "defend" their people.
Hamas' non-military wings have grown the same way; out of a necessity to do some non-military tasks as necessary to continue the major focus, which remains jihad. For example, Hamas leader Nizar Rayyan's role was to bridge the military and non-military wings of Hamas - a purely practical role that indicates the primacy of jihad in Hamas.
Westerners stricken with a particularly extreme case of wishful thinking disease like to seize on these different "wings" as evidence that there is a huge separation of duties and goals between them. In Hamas' case. the fact that separate "security forces" report to the same "ministry" indicates that the separation is practical, not doctrinal. Add this to the fact that a majority of Palestinian Arab police killed in Gaza also belonged to Hamas' armed wing and it is clear that no real distinction can be made between the two, just as no practical distinction can be made between the fighters and the people who procure weapons within the Al Aqsa Brigades who are not directly involved.