I'm not saying this story isn't true. But keep in mind this source has a heavy pro-Israel bias. I'd prefer to see a more independent source present this story.
The rules of war do not state it has to be used exclusively to commit attacks to be a legal target.
Rule 28. Medical units exclusively assigned to medical purposes must be respected and protected in all circumstances. They lose their protection if they are being used, outside their humanitarian function, to commit acts harmful to the enemy.
the protection of medical units ceases when they are being used, outside their humanitarian function, to commit acts harmful to the enemy. This exception is provided for in the First and Fourth Geneva Conventions and in both Additional Protocols.[37] It is contained in numerous military manuals and military orders.[38] It is also supported by other practice.[39]
While the Geneva Conventions and Additional Protocols do not define “acts harmful to the enemy”, they do indicate several types of acts which do not constitute “acts harmful to the enemy”, for example, when the personnel of the unit is armed, when the unit is guarded, when small arms and ammunition taken from the wounded and sick are found in the unit and when wounded and sick combatants or civilians are inside the unit.[40] According to the Commentary on the First Geneva Convention, examples of acts harmful to the enemy include the use of medical units to shelter able-bodied combatants, to store arms or munitions, as a military observation post or as a shield for military action.[41]
The rules of war aren't about perfection, they're very much a do not let perfect be the enemy of good, and filled with compromises to do less evil.
If you want protections for medical staff you have to clear a section of ground for them that isn't used for war.
It's important to realize these rules were agreed to in order to try to prevent total war. Where carpet bombs flattened entire cities like what happened in Dresden.
War is horrific. Those that wage war unleash hell. We cannot make war logically or compassionate. We can try to afford safety nets for those to help others and reduce harm in war. However, the rules do not elimt harm for "innocents." They simply offer a way to have less civilian casualties by doing things like not running a command center out of a hospital.
IIRC Israel regularly attempts to warn people before striking to give non-combatants time to leave and makes a point of NOT using their citizens as human shields.
Law of War is often referred to as the law of armed conflict (LOAC). This is what is permissively legal to do, if you are engaged in conflict.
The Rules of Engagement (ROE) are directives regarding the exact circumstances United States (US) forces will initiate and/or continue combat engagement.
Has the hostage takers used force such as firing a weapon to take the hostage? Did they fire at US forces? Did they deploy munitions of any type? Has there been an escalation of combat or have they disarmed? Is there an immediate threat to the hostage? Have they threatened to kill the hostage? Are they retreating or advancing? Are the hostages prisoners of war? Are they being provided the required treatment for POWs?
All of these and many more can determine the rules of engagement for US forces.
The ROE is separate to the rules of war and not all forces have the same methodology. In fact some nonUS forces may receive no training for LOAC or ROE.
Finally, the current interpretation post 9-11 is that those that do not follow the LOAC are not legally combatants and therefore do not have to be provided the protections that they would if they were legally combatants. So, if they engage in war in a way that does not follow the legal methods they may not hide behind the protections.
The original source of the attack was from Hamas...so there's that. And most sources outside these two bubbles tend towards the misfired missle from Gaza as the most likely explanation.