Why did the former SSR countries like Lithuania, Estonia, and Latvia face no trouble from Russia to join NATO and EU, while countries like Georgia and Ukraine facing Russian military invasions?
There are several reasons.
Lithuania, Estonia, and Latvia don't pose as significant strategic geopolitical threat as invasion route. Ukraine and Georgia do.
I covered the geopolitical motifs that drive Russia (the need to protect itself from invasion from West/Southwest/South due to lack of defensible natural borders) in another Politics.SE Q&A.
The following map illustrates the differences very nicely (hand drawn red squiggles mine). You will note that:
Latvia has a very small border with Russia, that's easier to defend, and further from Moscow. Lithuania has no direct border (Kaliningrad/Königsberg is irrelevant from this viewpoint). Estonia's border is more defensible due to water except for small area near Narva.
Ukraine has a huge ass-border, right near the best route to invade to Moscow from Europe (if you discount Belarus, which is firmly with Russia for now)
Georgia not only has a big border, it's also near Ossetia/Chechnya, which are... sensitive spots for Russia security wise
Similarly, Baltic republics don't offer much of a significant geopolitical value to Russia, comparatively.
They aren't resource rich (unlike Ukraine with its hydrocarbon resources or Georgia with all the resources in Caucasus region).
They don't offer great agriculture (being in the colder North; baltic area) unlike Ukraine and Georgia.
Baltic republics have strong affinity for Western Europe, and strong dis-affinity for Russia; for historical, cultural, and religious reasons. The effort to keep them out of Western orbit and in Russia's is much harder.
They were the very last republics that were forced to join USSR. They were the very first ones to want to separate from USSR. Most of Russian speaking population there are not indigenous. Their culture is largely that of Western Europe.
In contrast, Ukraine has an north-eastern region that is historically and culturally Slavic/Russian.
As far as Georgia, it has less affinity with Russia, but bullet points #4/#5 compensate for that.
Next two bullet points are kind of in reverse, in that they cover "why isn't NATO gung-ho to accept them"; but the fact that NATO is not gung-ho is precisely why Russia can afford to contest them more strongly as influence.
Georgia is very hard for NATO to defend. Professionals study logistics, remember? Georgia is at the end of a super long supply line, going through Turkey (which may not be in NATO much longer anyway).
NATO doesn't want either Georgia nor Ukraine as of right now as members, regardless of Russia.
Economically and partly politically, they aren't in the position to fit NATO requirements. (this can be elaborated on into a whole separate answer, if you're curious please ask as a separate independent question)
As someone noted in comments, even if Russia wanted to contest Baltic republics joining NATO, they weren't in a position to do so back then (2004) - Russia was just barely starting to try to recover from economic collapse of 1990s and political volatility.
Somewhat affecting both #1 and #2, water resources (both as far as invasion routes, AND as economic benefits).
Baltic republics have bleargh Baltic sea (and Russia already has access to Baltic as needed anyway).
Georgia and Ukraine have Black sea.
The naval base in Crimea is Russia's only warm water port.
Because they have their most important naval base there, there are many Russians in Crimea.
Once they already invaded Crimea, there was less preventing an invasion of eastern Ukraine, which also has a significant Russian population. I.e. they got away with Crimea, so it seemed like they could get away with eastern Ukraine.
Russia felt less secure about protesting in 2004 than in 2014.
Russia was already contesting Georgia and could not contest both sides.
Estonia, Latvia, and Lithuania are naturally limited. Of nearby countries, only Finland would be considered part of the old Soviet sphere.
Georgia gets NATO to Azerbaijan. Together, Georgia and Azerbaijan would block off that section of land and Russia ally Iran.
Azerbaijan would also give NATO access to the Caspian Sea, which leads to places like Turkmenistan, etc. From Russia's point of view, Georgia could be the start of a domino effect that would leave them surrounded by NATO and China.
Georgia borders rebellious parts of Russia (e.g. Chechnya), which might themselves want to leave Russia and join NATO.
It's also possible that events in eastern Ukraine weren't entirely managed by Russia. Obviously they encouraged the organization of the separatists, but it is unclear if they were actually able to assert control. The separatists did things against Russia's public utterances. While this could have been a Russian plan, it could also indicate that they didn't control the rebels. They may have been stuck with either supporting or abandoning the rebels, and they didn't want to abandon them.
From the outside, it is very difficult to tell if the rebels were listening to Putin's private utterances or not. Particularly considering that if they were, then having his private and public statements differ was an intentional strategy.
In general, we don't know if Russia tried to whip up an Estonian separatist movement. Maybe they did but failed. Maybe thinking about what they could have done in Estonia gave them ideas for Ukraine. Maybe Russians in Ukraine are more concentrated in the eastern regions and more spread out in Estonia. Maybe there are simply more Russian army personnel in eastern Ukraine than in Estonia. Maybe the importance of Crimea led them to build a distraction in eastern Ukraine that got out of control.
I'm not quite sure about Georgia, but as far as Ukraine is concerned this is what I know:
Ukraine is simply much more important for Russia in terms of building a new empire. Such a new empire might be built without the three Baltic countries but never without Ukraine. Ukraine's migration to the West is the death for Russia as an empire. This is why Russia did what it did to my country
I saw Putin explain this is an interview once, but I've since lost the video, so I can't link it. I remember the video was a Q&A session in which Putin was taking public questions. A white male journalist asks Putin in English about Russia's aviation and why he, as commander-in-chief, did not stop it. Putin answers in Russian. The video was, I am sure, on YouTube; I am however unable to find it anymore. If anyone does let me know and I will edit.
Basically Russia did object to the Baltic countries joining NATO. If you look at the relevant section on Wiki:
Shortly after the fall of the Berlin wall in 1989, the George H.W. Bush administration (1989-1993) began to debate internally whether enlargement of NATO was feasible and desirable. By mid-1992, a consensus emerged within the administration that NATO enlargement was a wise realpolitik measure to strengthen American hegemony. In the absence of NATO enlargement, Bush administration officials worried that the European Union might fill the security vacuum in Eastern Europe, and thus challenge American post-Cold War influence. There was an active debate within the Clinton administration (1993-2001) between a rapid offer of full membership to several select countries verses a slower, more limited membership to a wide range of states over a longer time span. Victory by the Republican Party, who advocated for aggressive expansion, in the 1994 US congressional election helped sway US policy in favor of wider full-membership enlargement.
At the 1999 Washington summit, where Hungary, Poland, and the Czech Republic officially joined, NATO also issued new guidelines for membership with individualized "Membership Action Plans" for Albania, Bulgaria, Estonia, Latvia, Lithuania, North Macedonia, Romania, Slovakia, and Slovenia. In May 2000, these countries joined with Croatia to form the Vilnius Group in order to cooperate and lobby for common NATO membership, and by the 2002 Prague summit seven were invited for membership, which took place at the 2004 Istanbul summit. Russia was particularly upset with the addition of the three Baltic states, the first countries that were part of the Soviet Union to join NATO. Slovenia had held a referendum on NATO the previous year, with 66% approving of membership. A 2006 study in the journal Security Studies argued that the NATO enlargements in 1999 and 2004 contributed to democratic consolidation in Central and Eastern Europe.
(Most relevant parts highlighted)
It didn't react the way it is doing with Ukraine, because at the time it lacked the resources to do so. After the Soviet Union collapsed, the Russian economy did very badly and it would take time to recover. The critical period when the Baltic states joined NATO was also a period when the Russian economy was still in the dumpster. As the economy improved Russia was able to do things such as resuming strategic air patrols (this was what the journalist asked Putin about), and act more assertively on the world stage.
Viewed another way, Ukraine and Georgia are suffering the consequences of not trying to join NATO in 1999.
The foreign policy of Russia have changed very significantly at some time between Baltic states joining NATO and that we see now. Today it will never be allowed and in general I do not think any country from the former Soviet Union would be allowed refusing to stay part of Russia. What happened at these times, was a miracle. There was more than enough military power, it was not applied. It is probably one of the biggest secrets in the history of that century. There were movements and demonstrations but these have already been crushed with tanks some time ago in other comparable places, with great success. Why not again? I do not know.
I am not sure why did this shift backwards happened. Obviously, very unfortunate.