Rifles existed during the musket era - muzzle loading rifles appeared during the early 17th century. They were however expensive and had horrendous rate of fire, so they were issued to special "sharpshooter" units, whose task was pretty much killing the officers in the field.
But yeah, by and...
Balkans however only broke free because the Ottoman Empire was on a downswing anyway, and it was on a downswing because it had relied on expansion to stay viable, and once the expansion ceased following the Battle of Sisak and the consequent Long Turkish War, the Empire started to slowly fall apart.
I would like to note that invention of the musket pretty much meant the end of effective barbarian hordes, as you needed the state to organize production and supply of weapons, while at the same time the main nomadic stregth - cavalry - became much less effective.
That, and Samurai bushido is not that dissimilar from European concept of chivalry. Both codes were basically an attempt at convincing a class of armed brigands to rein themselves in and behave honorably.
Japan during Shogunate era is quite similar to medieval Europe.
That is actually the precise point I was making: socketed bayonet was useful, but was not the primary defense of infantry squares against cavalry. Primary defense was always firepower. In fact, in pike-and-shot formations, shot protected the pikes from cavalry, while pikes protected the shot...
Bayonetted flintlock is shorter than the pike, and is thus worse at countering lancer cavalry.
As for new tactics, infantry square - which was the standard anti-cavalry tactics in the Napoleonic era - existed back in Antiquity.