It seems like there is no good reason for anyone to make a great power that can potentially declare war on them in the future
It was a compromise. In exchange for Prussia giving up a large part of Poland (including Warsaw which had been Prussian territory since the last partition) to Russia, the Prussians were given territory in the Rhineland. Prussia had a lot of claims in the Rhineland so it made sense.
Austria liked the exchange because in the time period right after the Napoleonic wars, the parts of Poland Prussia gave up were more valuable than the Rhineland. So Austria pushed for Prussia to get all that new land because the Austrians assumed they were actually weakening Prussia.
Unfortunately for Austria, the industrial revolution happened. The Rhineland became a hotspot for industry and resources like coal. Making Prussia very wealthy and very powerful. So the exchange backfired for Austria and worked out greatly for Prussia.