Well, Robert, in your examples, it seems that the hairpin needs to reach closer than a quarter beat from the written end dynamic, so why not place a hidden end dynamic on the beat after the hairpin? But to me, example 4 looks perfectly logical to me for human reading, and Sib is happy with it.
I don't know the precise rule, but it does appear to be roughly within a beat before, and absolutely not after, the attachment point of the dynamic, as judged with Magnetic Layout turned off temporarily.
--
Sibelius 2024.10/7.5.1/7.1.3/6.2/5.2.5, PhotoScore Ult 2020.1, Windows 10 64-bit 16GB. Desktop, and Microsoft Surface Book.