So disclaimer: I haven't looked at the code and don't know what's going on in there.
That said, it doesn't sound like setting lastopp to the parent will help. Or rather, it will only help creating ties to the parent. But you probably want to be able to make ties to any arbitrary bot.
Probably, if there's no lastopp set, you can just do a query in front of the bot to find the closest bot that the current bot is reasonable pointed to, and tie to that.