Section 408(d)(4) pertains only to IRAs. The federal TSP is not an IRA.
With regard to the federal TSP, there is no such thing as a return of contribution before the due date of your tax return. Elective deferrals are irrevocable, so if you received a distribution before reaching age 59½, the distribution is an early distribution subject to penalty and code 1 is correct.