According to multiple online dictionaries, bejesus is a quite common mild expletive used to express surprise and/or dismay and is derived from by Jesus. But what does it mean? The phrase “you scared the by Jesus out of me” doesn’t seem to make much more sense than the derivative expression.
It simply means the thing was scary enough to cause you to speak that oath.
Compare “scare the crap out of”, which means the thing was scary enough to cause you to defecate.
The oath by Jesus itself is already in print by 1863:
By Jeſus, quoth Ben. Johnſon, (his uſual Oath) I believe this is my son Randolph, which being made known to them, he was kindly entertained into their company, and Ben. Johnſon ever after called him Son.
—The Philobiblion: a monthly bibliographical journal, Volume 2, by George Philip Philes
But using be for by in dialect speech is earlier (1848):
“Be Jasus! and well you may be, my dear frind!” cried the gallant gentleman. “But who is the governor, d’ye say?”
—The mysteries of London, Volume 4, by George William MacArthur Reynolds
The single word bejasus appears in 1882:
One mad-looking fellow put his bayonet to my side, and swore, “bejasus, he would skipper me.”
—The Battle of Groton Heights, by William Wallace Harris
The earliest example of “bejesus out of” I could find is from 1932:
[T]he most interesting and at the same time the most frightening spectacle of the modern world is probably Gary Cooper’s new house. The decorations are late African in period, and are guaranteed to scare the bejeezus out of any slightly cock-eyed sightseer who might have the misfortune to get locked in after closing time.
—Motion Picture, Volume 44 [emphasis added]
Note the variant spelling in the quotation above. The spellings bejesus and bejeezus both first show up in 1932; bejaysus late in the same decade. The slightly more euphemistic “bejeebers out of” is much more recent; it first shows up in a letter to Time Magazine in 1973.
The etymology of the word reads:
mild expletive, 1908, perhaps from by Jesus. To beat the bejesus out of someone is from 1934.
As the OP has noted, the word appears to be an ameliorated version of the exclamation, "By Jesus!", and appears to have been a preferred expletive of the Irish.
Here's an excerpt from Gas House McGinty, a novel by James Thomas Farrell (1933):
Over here, the Sammies marched down Michigan Boulevard while the bands played, and the natives cheered and waved the flags they had bought in Woolworth's jitney gyp joints. And bejesus, did the bands rum-tum-tum, and did the natives ...
One can extrapolate that the word, through extensive use, took on a life of its own as an oath, shedding its "By Jesus" roots. This eventually led to its current use as seen in this 1937 excerpt from To Quito and Back by Ben Hecht:
Besides I used to whip the bejesus out of Zamiano when he was a snotty little brat. I should have murdered him. Isn't it gloomy.
Wiktionary's definition of bejesus states:
(euphemistic) Used for emphasis, similar to crap, shit or wits.
The bear scared the bejesus out of us.