Why were there separate Bavarian army corps, as well as a separate Bavarian cavalry corps? Also, what was the reputation of the Bavarian units when compared to other Imperial army formations?
Some states ( the Kingdoms ) of the German Empire were allowed to keep their own armies which at least partially were controlled by the war ministry of the respective state. In case of war these armies would be controlled by the German Empire. After the war all these armies were disbanded by the Treaty of Versailles.
When "Germany was founded/unified" after the Franco-Prussian war the Prussian ( northern confederation ) war ministry basically became the new ministry of war for the entire German Empire with exception of Bavaria, Saxonia and Würtemberg who joined the northern confederation. These states kept their ministries of war with their own General staff. Bavaria had a special position with only being subordinated to the Grand General command/ Emporer in case of war while Saxonia and Württemberg were also in peace subordinated to Imperial Army but all three had certain privileges and administrated their troops. A unified Germany was rather new and the states had still their own interests. The four aforementioned states had the biggest contributions in the Franco-Prussian war, with Prussia having the biggest army and becoming the "center" of the German Empire.
It should be noted that the German Empire had only a few bigger states the biggest part of the population was combined within Prussia, Bavaria, Baden, Hessen, Saxonia and Würtemberg. Most states of today were provinces of Prussia and part of the Prussian army. The states of modern Germany developed after World War II and the dissolution of Prussia which was seen as one root cause for repeated German aggression. The east-west divide shaped the states ( Bundesländer ).
edit: Was a bit wrong there technically only Bavaria army was completely autonomus during peace time.