Agreed, but these were Borgified Federation ships using Federation tech. Presumably they assimilated the knowledge and history of how the Federation had defeated similar cloaking devices before.
maplealmond
Jumping on your notes of Criminal Justice: In the episode "Ensign Ro" there was this throwaway line
RO: Well, if he's sent to the stockade on Jaros Two, tell him to request a room in the east wing. The west wing gets awfully hot in the afternoons.
When I saw this as teen it did not really strongly register with me. Thinking about it now, though, with the real world context of prisoners dying in cells because of heat, I find it significantly more disturbing. The Federation has the power to control the weather. Energy is cheap enough to be free. They have cells which are uncomfortably hot.
I have noticed that even among the most liberal, high minded members of society on the topic of justice, or the most anarchist-lefty abolitionists of prison, certain crimes still stoke the fires of vengeance. Hurting children or engaging in treason still stokes some serious desire for vengeance, and I would not be surprised if a degree of discomfort as applied to punishment never goes away. The more the Federation faces attack or external threats, the more the public might be swayed to making the criminals "pay"
I am admittedly basing this on The Next Phase, where Ro and Geordi stay phased without anything keeping them phased, and where Ro shoots Riker point blank in the head with a phased disruptor, and he feels nothing.
But now that you mention it, we would need to reconcile that, of course, with the fact that the Pegasus dropped back into normal phase when the cloak failed.
I had not considered a torpedo with an integrated rephase module. Maybe this could work (and there would be great value in a torpedo that phases back after passing through a shield bubble) but we don't commonly see torpedoes with deflector grids, cloaking devices, etc.
But I would concede there could be some interesting research here. However the Federation might decide not to advance it anyway as it's very clearly a treaty violation, whereas "ship that has good emissions controls and a finely tuned deflector grid" is not.