That sequencing is right. Worth checking whether you have tax-deferred space you can rebalance inside instead — for most households the IRA or 401(k) is large enough to absorb the whole adjustment without a single taxable trade. If you must sell in taxable, look for lots with the highest basis and pair the gain against any harvested losses you are carrying.