Your puzzlement derives from a misreading of the text. First, "Maghreb al-shams" or "setting of the sun" is a time not a place. "Until he reached" in Arabic doesn't connote a place necessarily but could be a time, and in this case, is a time, aka in Arabic maghreb al-shams, or sunset. Now it is true that it also means "west", the direction of sunset, but the use of "shams" or "sun" is to make clear that this refers not to the maghreb of place which would not include the word "sun", but the time of the setting sun. Like "he arrived at sunset". And speaking of "at"...
The second, and far more important, issue is your (quite odd) interpretation of the Arabic preposition "fee" في and its usage. It is comparable to the English prepositions "in" or "at", whose usage is sometimes, like "fee", interchangeable. One can say, for example, "at home" or "in my home." Note that the meaning is the same, but in English we have to add the "my" to use "in" with home, indicating the difference between "at" and "in" can overlap, i.e., they can mean the same thing. Both meanings also can apply to the Arabic "fee". So if one says
Then he (Thul-Qarnain) "found it (the sun) setting at a mud-spring", it becomes apparent that the sunset occurs at a location which has a spring of mud, perhaps a spring occurring in an area of clayish soil, which over time became mud. The following is a translation using "at" (I admit it was hard to find one, but many of these translators are not native Arabic speakers or know Arabic only from modern colloquial usage and what they hear from others):
Until he reached the setting of the sun; he found it setting at a hot
spring, and he found a people near it. We said: “O Two Horned One,
either you shall punish, or you shall do them good.”
(Note: I also disagree with the "hot springs" translation, which has no direct bearing on the use of "at".)
The use of Arabic and English here are not so vastly different, though. One can say "the sun set in the valley" and not a single thinking person will presume it means the sun literally set in the valley. If I say in English or Arabic (using "fee") "I squeezed the oranges in my house," one will presume one is squeezing the oranges not literally into the house as a receptacle but rather one is located in the house squeezing oranges into something like a glass, for example. "In" or "fee" does not necessarily mean "into", even though the word "squeezing oranges" implies "into" something. But the absurdity of squeezing oranges into one's home precludes that interpretation.
In the same way, the absurdity of the sun setting directly into the physical muddy spring precludes that interpretation, hence no need for "as if." However in defense of the "as if" translation, it may be implied that the sun appeared to set (by virtue of its reflection of sunset colors on the mud), or one could say placed its sunset colors on, the muddy spring. I am sure no one at the time believed the sun literally set into the spring, or by that time, someone of that nation/ people would surely have tried to find it and possibly remove it.
Further evidence: the "people" were found also "in" the antecedent ,(not the muddy spring which is an aside but) the sun, and I'm also sure no one believed a nation could live "in" the sun or indeed for that matter, in a muddy spring (inside, like the alleged setting sun).
This is a description of place which may have been a "sign" for Thul-Qarnain regarding his destination, but in any case cannot mean the Quran is espousing the flat-earth theory. It has nothing whatsoever to do with that. Have you ever seen the sun set into the ocean, and did that make you a flat-earth believer?
I'm not blaming you; almost all translations used "in" or even "into", causing a couple of them to go with the metaphor using "as if." I think it is a strongly visual description, made presuming that we are using our minds. "Afa laa t'aqiloon?"
In addition, the second aya you quote in your question 18:90 has nothing to do with this issue. It does not say the sun is rising literally and physically out of the earth — to make that point unequivocally clear would require different phrasing — but that he reached that place at the time/ place of sunset and discovered there a people/ nation who had no respite from the sun once it rose. In those days the rising and setting of the sun were significant markers of both time and distance, and this was a journey over varying terrain.
As for the hadeeth, I would say the narrative may have been misquoted or mistranslated, but in either case, the idea of the sun rising out of or into a body of water directly and physically is certainly incorrect, and is not substantiated by any correctly understood Quranic aya. (And this is not the only fallacy implied by such texts of hadeeths; there are "weak" hadeeths and, according to Bukhari, "wrong" hadeeths, 2,000 of which he supposedly memorized, according to one of the quotes attributed to him. Don't take this one to the bank.)