I'm going to send you a PM for a test version.
Sent you the results, at this point I think mpds curl implementation is just fickle.
Does UPnP Eventing provide track progress (for renderers that support it)? I don't know how often you're polling, or the latency of replies, but I'm sure with a few carefully timed requests you'd be able to work out when the second is ticking over. That or add half a second to every update 
Alternatively you could add a configurable offset in the plugin settings +-xxx ms (assuming the delay is at least consistent). If the upnp renderer only reports seconds precision, you could first ping the upnp device 5 times, average the result, add 20ms to that (or use a minimum of 50ms, that's more than precise enough) and use it as a polling rate. Then poll over more than 1s to narrow down the moment the second value changes.
I just pinged 3 of the pis and the usual ping was 1ms with a single ping of 9ms as an outlier.
I would've liked to propose the solution to upnp delay with synced lyrics (which are most sensitive to this problem) that Symfonium uses here as well, but you probably have no way to influence the lyrics panel.

With the + and - you can adjust the lyrics offset in Symfonium to compensate for upnp/bluetooth delays (or poorly synced lyrics) during playback.
I tried to use Symfonium on android but it wouldn't detect my plugin at all. Neither the Mediaserver or Renderer devices. Foobar showed up but nothing I did could get it to show Musicbee. Not sure what the issue is there.
If you open a support ticket on the
Symfonium forum with debug logs, Tolriq (the dev) will most likely be able to tell you why your plugin does not show up. I've used Symfonium to cast to the pis, an onkyo receiver, Kodi (running on my HTPC) and a couple smart TVs. It's upnp implementation is pretty mature and the sync usually pretty good too.
"- NextURI will now be cleared if the associated track is removed from the now playing list and there is nothing to replace it."
This does not work for me.
I select 2 songs, start playback and the 2nd song is set as nexturi:
1756610; 109 Activate - MaltePi3B-UPnP/AV:http-get:*:audio/L16:DLNA.ORG_PN=LPCM,http-get:*:application/flac:*,http-get:*:application/x-flac:*,http-get:*:application/ogg:*,http-get:*:application/vnd.apple.mpegurl:*,http-get:*:application/x-mpegurl:*,http-get:*:audio/flac:*,http-get:*:audio/x-flac:*,http-get:*:audio/aac:*,http-get:*:audio/x-aiff:*,http-get:*:audio/aif:*,http-get:*:audio/aiff:*,http-get:*:audio/dff:*,http-get:*:audio/x-dff:*,http-get:*:audio/dsd:*,http-get:*:audio/x-dsd:*,http-get:*:audio/dsf:*,http-get:*:audio/x-dsf:*,http-get:*:audio/m4a:*,http-get:*:audio/x-m4a:*,http-get:*:audio/matroska:*,http-get:*:audio/x-matroska:*,http-get:*:audio/mp1:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/mpeg:*,http-get:*:audio/x-mpeg:*,http-get:*:audio/ogg:*,http-get:*:audio/vorbis:*,http-get:*:audio/x-ape:*,http-get:*:audio/ape:*,http-get:*:audio/x-monkeys-audio:*,http-get:*:audio/wav:*,http-get:*:audio/x-wav:*,http-get:*:audio/wave:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/x-ogg:*,http-get:*:audio/x-scpls:*,http-get:*:audio/x-vorbis+ogg:*,http-get:*:audio/x-vorbis:*,http-get:*:audio/x-wavpack:*,http-get:*:video/mp4:*
1761238; 110 Play - Z:\M4\bôa\Race Of A Thousand Camels\03 Duvet.flac (http://192.168.1.5:49382/files/BB9D29AE1267C776p.flac)
1761271; 111 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
1761275; 112 GetFile[17] 192.168.1.5 - GET Z:\M4\bôa\Race Of A Thousand Camels\03 Duvet.flac to 192.168.1.13
1761280; 113 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
1761397; 114 StateTimer - Playing,old=Stopped
1761415; 115 SetNextAVTransportURI - Success - http://192.168.1.5:49382/files/46F076508A85353Fp.flac
1763493; 116 GetFile[17] - exit=0, playtime=2209
Upon removing the second song from "Upcoming Tracks" in MusicBee, nothing new is logged by the plugin and when the first song ends, the second one starts playing with MB stuck on displaying the first one.
1941531; 117 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
1941537; 118 GetFile[18] 192.168.1.5 - GET Z:\M2\Lola Marsh\Someday Tomorrow Maybe\02 Only For A Moment.flac to 192.168.1.13
1941625; 119 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
1943255; 120 GetFile[18] - exit=0, playtime=1626
1964952; 121 SetNextAVTransportURI - Success - http://192.168.1.5:49382/files/46F076508A85353Fp.flac
The 2nd song is even repeated once before playback stops.
2380779; 122 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
2380784; 123 GetFile[19] 192.168.1.5 - GET Z:\M2\Lola Marsh\Someday Tomorrow Maybe\02 Only For A Moment.flac to 192.168.1.13
2380798; 124 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
2382461; 125 GetFile[19] - exit=0, playtime=1660
2572578; 126 StateTimer - Stopped,old=Playing
2572583; 127 SyncNewPlayState - Stopped,mb=Playing
Even more interesting is that upon adding another song to the Upcoming Tracks and then switching to the next song, the 2nd song is set as the nexturi once again.
2606134; 128 Play - Z:\M4\Razorlight\Slipway Fires\01 Wire to Wire.flac (http://192.168.1.5:49382/files/1140C30883183379p.flac)
2606167; 129 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
2606182; 130 GetFile[20] 192.168.1.5 - GET Z:\M4\Razorlight\Slipway Fires\01 Wire to Wire.flac to 192.168.1.13
2606211; 131 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
2606306; 132 StateTimer - Playing,old=Stopped
2606336; 133 SetNextAVTransportURI - Success - http://192.168.1.5:49382/files/46F076508A85353Fp.flac
2607943; 134 GetFile[20] - exit=0, playtime=1727
And when I start playback with only a single song and that song ends, the plugin probably goes into an infinite loop of attempting to set the nexturi. I had 12.000 lines of log after a couple seconds with:
3074663; 1694 PostSoapRequest - 500,send=POST /uuid-677a63db-6686-01d7-34a0-b827eb0b7fae/ctl-urn-schemas-upnp-org-service-AVTransport-1 HTTP/1.1
Host: 192.168.1.13:49152
User-Agent: MusicBee UPnP Plugin
Content-Type: text/xml; charset="utf-8"
SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#SetNextAVTransportURI"
Content-Length: 352
<?xml version="1.0" encoding="UTF-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SetNextAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><NextURI /><NextURIMetaData /></u:SetNextAVTransportURI></s:Body></s:Envelope>
3074667; 1695 SoapRequest:SetNextAVTransportURI:urn:schemas-upnp-org:service:AVTransport:1:InstanceID=0,NextURI=,NextURIMetaData= - <?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>Action Failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
3074671; 1696 SetNextAVTransportURI - Failed -