The position of Science Officer is alive and well in the 24th century.
You're implying several things. So I'm going to try and answer the question with some framing.
The question is "Why did DS9 need a science officer?" So first we need to understand what a science officer does.
From Wiki:
https://memory-alpha.fandom.com/wiki/Science_officer
Generally:
The science officer was the senior staff member aboard a starship or
starbase with the broad responsibility of coordinating the science
department of the post. (TOS: "Balance of Terror")
Science officer was a standard position aboard space vessels.
Starfleet, Arkonian, Klingon, Romulan, and Vulcan vessels all operated
with science officers. (ENT: "Dawn", "Impulse"; TOS: "Day of the
Dove"; TNG: "The Next Phase"; DS9: "Soldiers of the Empire") In the
Vulcan High Command, the science officer was assisted by a deputy
science officer. (ENT: "Impulse") In Starfleet, several junior science
officers assisted the science officer. (VOY: "Flashback")
Responsibilities(defined prior to the 24th century):
Science officers were responsible for observing and theorizing
explanations for strange or seemingly unexplainable circumstances.
(TOS: "The Savage Curtain") In the 22nd and 23rd centuries, the
science officer was responsible for sensor readings. (TOS: "Spectre of
the Gun")
A general survey party required the direction of the science officer.
(TOS: "The Ultimate Computer") In a medical emergency, the findings of
the science officer were heavily relied upon. (ENT: "Observer Effect")
The science officer was required to keep sufficient data. (TOS: "The
Immunity Syndrome") They were also required to supply the commanding
officer with all reports, observations, and speculations that might
have affected the safety of their vessel. (TOS: "Where No Man Has Gone
Before")
You mention in your question that in the 24th century Voyager and the Enterprise-D have no science officer, "...there really isn't such high-ranking position on NCC-1701-D or Voyager." I think your confusion may be that an officer can and in this case does hold two prominent positions, they are not mutually exclusive.
On a starship, science officer duties could be assumed as part of a senior officer's other duties.
Data served as both science officer and operations manager on the USS
Enterprise-D
Spock served as both science officer and first officer
on the USS Enterprise.
In 2270, James T. Kirk considered Commander Spock to be the best
science officer in Starfleet. (TAS: "The Jihad")
So the best example based on your question from the 22nd century would be Spock. Spock was first officer as well as science officer. Data was operations officer as well as science officer.
In addition on TNG there are other mentions of a science officer:
In 2368, Captain Jean-Luc Picard honorably made Jay Gordon Graas an
acting science officer during a ship-wide emergency. (TNG: "Disaster")
In 2369, acting Captain Beverly Crusher briefly assigned Ensign Taitt
as the science officer aboard the bridge. (TNG: "Descent")
So we see from TNG that the concept of a science officer was alive and well but Data had that firmly in hand. Spock is usually referred to as first officer not science officer, which is his more senior title. Data was the second officer and operations officer which were both more "senior" (for lack of a better term) titles. Also with the exception of Doctor or occupational titles (Counselor Troi) usually the rank was used on the Enterprise-D, ie; Commander Data, Lieutenant LaForge, Ensign Crusher, etc.
As for Voyager I would argue that Janeway herself was acting as science officer due to her knowledge and skillset which was laid out in "Caretaker" as she was referred to having this position on the USS Al-Batani. Later when 7 of 9 arrived she aided in these duties in the Astrometric lab. I would also posit that since Janeway had a short mission that was relegated to only capturing a Maquis ship in the badlands, a military assignment, and not one of exploration, a science officer may not have been assigned as part of the crew compliment.
So why on DS9?
From the 24th century and DS9 specifically:
According to Jadzia Dax, it was a science officer's job to always have
a "better idea." (DS9: "Paradise")
Based on the information I supplied of what a science officer does and is, namely, to coordinate the science positions, go over sensor logs, keep data, provide info in medical emergencies, supply theories and provide command officers with information to make informed decisions, that's exactly what Jadzia's role was.
A good example of this is in the DS9 episode "Visionary":
Going over sensor logs:
DAX: I went over the internal sensor logs and I did find evidence of a
minor temporal disturbance in Quark's and another one later on the
Promenade. Both disturbances happened at about the same time as the
Chief's experiences.
SISKO: So it would seem that you did travel into
the future and then returned to the same moment that you left.
O'BRIEN: Have you any idea what might have caused this time shift?
Providing info in medical emergencies:
DAX: Not yet. I want to go over the medical scans Julian took of you
earlier. That dose of ionising radiation you received might have
something to do with it. O'BRIEN: How?
Theorizing and providing scientific data to senior officers:
DAX: I'm not sure, but it's a good place to start. I have heard of a
couple of theories that ambient low level radiation could have a
temporal...
There are many more examples in other episodes of Jadzia fulfilling the duties of science officer, but "visionary" had the complete answer in one episode. If you would like more, comment below and I will provide some more.
The answer is that on a space station the size and importance of DS9, it was necessary to have a science officer aboard to help with any science based issues that may arise.