I agree with @Synthesis that your setup will work, it will just require wiring changes in your fixture box as well.
My only addition to the steps provided is to put a small wire nut on each end of the black wire that goes from the fixture to box 2. It’s not needed but it’s best to cover with a wire nut or electrical tape. Believe code may also require this in some areas.