For iPhone 7's that have a loose Audio IC not even iOS 25.x is going to fix it. If your speaker is grayed out and all you can do is use BT, as you have described, it is a hardware problem. It is not caused by any update, although doing one can reveal it and your really have 3 options: (a) Pay Apple for an out-of-warranty replacement and get a service replacement unit. I would not go that route at this point when you can buy a new iPhone SE 2020 for less than $100 more, (b) buy some other phone or (c) find a 3rd party repair shop that can do microlevel soldering and have them re-ball the four connection points that are usually at issue, and do ask and make sure they did all four. Prices have been dropping for this option. Keep in mind if you go this route Apple may refuse future service on your iPhone, but that really should not be an issue.