Hi!
I would say the Audio IC, but this is probably not it, because you still have sound wired, docked and also with the headphones.
I would try to replace the speakers actually. As you have stated "Speakers started to have bad sound quality". I would just replace them and see how it goes. They are easy to replace!
Guide: [guide|113169|Nintendo Switch Speaker Replacement - iFixit Repair Guide|new_window=true]
Let me know if you need parts or something else!