So, how do you think, what really went on in Dumbledore's head regarding that matter?
It is impossible to say what went on in Dumbledore's head. But we can look at his behavior and try to deduce possible reasons why he behaved that way.
Regarding the inevitability of a prophecy, Dumbledore himself says
"You are setting too much store by the prophecy!" ... "If Voldemort had never heard of the prophecy, would it have been fulfilled? Would it have meant something? Of course not! Do you think every prophecy in the Hall of Prophecy has been fulfilled?" ... "Harry, Harry, only because Voldemort made a grave error and acted on Professor Trelawney's words!" (HBP)
So Dumbledore basically says that a prophecy means nothing unless someone hears it and decides to act on it. But Dumbledore knows that Snape heard the beginning of the prophecy. He knew that Snape was a Death Eater and allowed him to get away with his memory of the prophecy and without an unbreakable wow that he will never tell anybody. As the prophecy was made before Harry's birth, Dumbledore might not have known that it referred to the Potters, but as he will be born to those who have thrice defied him, that means that whoever it is, it is someone who is against Voldemort. So it would make sense to prevent Snape from telling about the prophecy, unless that is exactly what Dumbledore wanted.
Then time passes, and on Halloween Voldemort kills the Potter parents. Dumbledore somehow knows about this, but doesn't bother to go there himself to find out what happened. Instead he sends Hagrid, who later told
"No, sir – house was almost destroyed but I got him out all right" (PS)
Anything that destroys a house is likely to cause enough debris to cause significant injuries to an adult, and even more so to a baby. And is it Hagrid's task to bring Harry to the hospital, or to the Hogwarts infirmary? No, his task is to bring Harry directly to the Dursleys. Before Dumbledore even saw Harry after his parents were killed, he decides that Harry should go to the Dursleys. Later he tells Harry that he knew before he sent him there
"I knew I was condemning you to ten dark and difficult years" (OotP)
When he talks to McGonagall outside the Dursleys' house, he says
"He’ll have that scar for ever."
"Couldn’t you do something about it, Dumbledore?"
"Even if I could, I wouldn’t. (PS)
So he wouldn't remove the Horcrux in Harry's head even if he could. But this Horcrux is the reason Harry has to die. This changes only after Voldemort's resurrection, and is not something Dumbledore could have planned for. Otherwise Dumbledore would not be pleasantly surprised.
"For a fleeting instant, Harry thought he saw a gleam of something like triumph in Dumbledore's eyes. But next second Harry was sure he had imagined it" (GoF)
This is later explained
"He took my blood," said Harry.
"Precisely!" said Dumbledore. "He took your blood and rebuilt his living body with it! Your blood in his veins, Harry, Lily’s protection inside both of you! He tethered you to life while he lives!" (DH)
So we know about Dumbledore's plans regarding Harry. It was to condemn him to ten dark years, and after that he had to die, unless something unexpected would happen. He made this decision within one day and without even seeing Harry, or he made that decision even before Harry's parents were killed. So as Dumbledore has no problem to set up Harry for ten years of abuse followed by death, it is no big leap to assume that he also didn't have a problem to sacrifice the Potter parents.