I would go further: software should always be optional in any hardware purchase and the price of hardware with software should be higher than the price of the hardware alone. Discount bundles with software + hardware should not be allowed. So no iPhone + iOS or laptop + Windows as one item.
Selling hardware and software separately ensures that the hardware can be repurposed with independently sourced software. That gives control to the user and reduces e-waste.
This should include 'firmware'. The benefit for the manufacturer is that they can charge for software updates. But the consumer can choose to get the update from elsewhere.