If I do a 1031 exchange, does the recapture from my cost seg go away?
No. At best it is deferred. The replacement property generally takes the old property's basis, so the depreciation you took stays built into it and is counted when you later sell in a taxable sale.
Some recapture can be due at the exchange itself. For section 1245 property, such as the 5- and 7-year parts, recapture is deferred only up to the value of section 1245 property you receive; value you receive in other property, such as a replacement building, or in cash, can be taxed as ordinary income now. For section 1250 property, recapture is due up to the greater of the gain you recognize, such as from cash, or the amount by which it is more than the value of the section 1250 property you receive. Since 2018 an exchange covers only real property, so value assigned to furniture is taxed like a sale.
Deferred recapture is not taxed if you hold the replacement until death, because recapture does not apply to a transfer at death.
Learn more: One-pager: you did a cost seg, now you want to sell · Explainer: what happens when you sell
Source: 26 U.S.C. 1245(a) and (b), recapture on section 1245 property and its exceptions · 26 U.S.C. 1250(a), (b) and (d), additional depreciation and exceptions · Treas. Reg. 1.1250-3(d)(1), like-kind exchange limit and carryover of additional depreciation · Treas. Reg. 1.1245-2(a), recomputed basis counts depreciation on other property · 26 U.S.C. 1031(d), basis of property received in an exchange
General information, not tax advice. Tax law changes, and the right answer for your return depends on your facts.