Some say government pulled this off (courts follow the orders of Erdogan) to force the hand of the opposition to appoint the Istanbul mayor as presedential candidate. This can cause turmoil within the opposition leaders. Erdogan may be trying to achieve this.
He also tests his power and the public's reaction. If the public cannot react to this and he can influence the court of cassation, he will secure his position as a dictator for life.
He was able to influence the court of cassation in previous cases, however this is a major case. We all hope that his power is not strong enough to influence the high court on this matter by ordering them to approve such a baseless claim.