Because it's the duty of a functioning government, one that receives taxes from its citizens, to provide for a defense of their nation.
Are you a citizen of one of those countries? Why don't you write the EU a letter?
I don't know if you are just naive, but most governments don't spend money on anything they don't have to, except making sure they and their employees are well compensated.
Why would European governments be any different than other governments?