I had a similar experience from a different perspective -- I took a course on Theory of Computing, which was 50/50 gate-level CPU design and mathematical work on computability, automata and so on. I found this interesting as an intellectual exercise and to get a grasp on what is computable and what isn't, but then the next semester it proved super useful in the compiler design course.