He achieved his goal of celebrating a historic — and divisive — legislative victory in time for the nation’s birthday.