Riverrun was secure enough; the problems Edmure ran into was that Tyrion was massively violating the social contract (and he did manage to prevent that prison break), and that he couldn’t have foreseen Catelyn’s actions either.
Moreover, Robb doesn’t necessarily want Jaime in a castle cell two whole kingdoms while he’s got him hostage. Contrary to the fandom impression that Robb was completely opposed to peace with the Lannisters, Robb was willing to make peace on his terms and would have needed Jaime on hand if necessary to cement the treaty (even if that was a few years later).