Wish I'd have seen this sooner. You definitely figured out the process but it's a little convoluted. In addition to the above, two other things to consider for someone else in your position.
1. You don't HAVE to turn the car in, sell it, or buy it at lease expiration. You can call them and tell them you intend to continue making payments and extend your lease for another 12 months. They'll reset your RV and it sometimes leads to a lower payment since the depreciation will be lesser in the next 12 than the prior 36.
2. If you want to retain the vehicle, yes buy it. BUT, with used vehicle prices what they are, you can sell it directly to a retailer and they'll pay the tax on the purchase and not you. Then just make sure you have something on order so they don't hit you with a "market adjustment" when you go to replace it with something else.
We did this with our 2018 F-Pace... sold it in February this year at the end of the 4th year, directly to a non-JLR dealership. Car was 68k new, updated RV was 29k, got offered 40, they sold it for 48. I saved about 2k on taxes alone and just pocketed the 11k. The dealership paid the bank directly using that "other" person you had to call inside 6 months, which is still just JLRFG (aka Chase Auto.)