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:
But using be for by in dialect speech is earlier (1848):
The single word bejasus appears in 1882:
The earliest example of “bejesus out of” I could find is from 1932:
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:
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):
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:
Wiktionary's definition of bejesus states: