I mean, the mainland japanese defense was regarded as almost impenetrable, even to the point that a land invasion was deemed almost impossible. So how did the bombers actually pull off the bombings with practically no escorts? Was it because of their high altitude flight?
The other linked-to thread addresses the specifics of the Japanese situation, but just addressing the following statements:
the mainland japanese defense was regarded as almost impenetrable
This is totally wrong. By late 1945 the US had multiple B-29s and other bombers over Japan nearly every single day. Japanese anti-air defense was strained and weak, and couple not at all cope with either the large raids the US sent against them, or the multitude of individual planes that were being used for weather or reconnaissance.
As I wrote once before: "the magnitude of the air war on Japan at that point is staggering and easy to forget when we focus on the atomic bombings. Even without considering the incendiary raids. On the same day as the Hiroshima bombing, there was a raid of 150+ P-47s and A-26s attacking Miyakonojo, 170+ B-24s, B-25s, and P-47s hitting Kagoshima, and 100+ fighters from Iwo Jima attacking military installations around Tokyo. The day before Hiroshima, 330+ B-24s, B-25s, A-26s, P-47s, and P-51s attacked Tarumizu, and 470 B-29s flew incendiary raids against the cities of Saga, Mae Bashi, Imabari, Nishinomiya-Mikage. Another 106 bombed a coal factory in Ube, and another 27 mined the waters of Sakai, Yonago, Nakaumi Lagoon, Miyazu, Maizuru, Tsuruga, Obama, Najin and Geijitsu. 100+ P-51s hit military targets around Tokyo."
even to the point that a land invasion was deemed almost impossible.
Also not correct. There were many debates about how costly the invasion of Kyushu would be, but nobody thought it was "almost impossible." The majority of military opinion thought it would not be nearly as costly as the island hopping campaign.
Lastly, I would just note that the entire reason to send unescorted, individual B-29s is to make it impossible for the Japanese to tell that they were carrying the atomic bombs. And for Hiroshima, of course, the fact that an atomic bomb was going to be used was itself a secret surprise for the Japanese. Even for Nagasaki, the Japanese would have had no way to know when the next atomic bomb attack was coming, if there even would be one, nor where it was going to be dropped. So their defense options were pretty much nil, unless they wanted to waste all of their efforts trying (likely fruitlessly) to chase down every random B-29 that they detected. Keep in mind that their amount of aviation fuel was limited.
This was touched on in a recent post here