I think Obama just wanted to release those five Taliban leaders. He wants to clear out Guantanamo entirely so why not start with releasing the five worst prisoners?
Getting Bergdahl back was just meant to provide cover--he didn't anticipate that the country would fail to cheer the return of a deserter/defector.