So how could a wallet handle this case better if this case is not even reliably detectable?
The main way has been by manually banning payments to LN nodes that are known for hodl invoices.
In the future, there will probably be more defenses implemented, like better ways to cancel a pending payment, charges for holding up HTLCs, etc.