They have essentially the same meaning and they are correct, provided that you understand that the missing subject at the beginning is "I" and that this is casual speech. "that way" is more usual than " in that way". ( I ) don't know why I [hadn't thought / didn't think] of doing it that way.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.