The basis for the BoM comes from Freemasonry writings since Mr. Smith was a Freemason. Smith took what he wanted from them and twisted it for his own nefarious purposes. The Freemasons writings come from the Kabbalistic writings of the rabbis that they took and ran with and twisted it for their own purposes, also. The BoM is just a distortion of a distortion.
Actually Joseph Smith wrote the BoM years before he learned anything about Freemasonry. The Temple rites, however, were heavily dependent on Freemason rituals.