That's a very different circumstance. In your cases you weren't being loyal to a company but to a person who reciprocates, which is just good networking.
This is an important distinction. Organizations cannot return loyalty. People can. People who care about you will want what is best for you and not only think about the companies needs. Those people may work to keep you, but it is the people not the organization that make the effort.
Talk to your manager. If his/her first response is about the company and not about you, leave. You have made a simple attribution error in assuming extended proximity and a friendly work environment equates to loyalty.
If your manager's first response is about you then talk it out. Tell them why this is better for you. Communicate your concerns about asking for a counter-offer (well defined above). Most every day at a job is about the company, with the exception of when your paycheck arrives, when you get a raise or are disciplined, and days like this. If they cannot make an effort then you know where you stand.
Do not take this over your bosses head. If he/she is competent and cares/returns your loyalty, then he/she will do that for you. If not, then the senior managers you feel loyalty for have not filled their side of the implicit contract and anything you do will undermine your boss who you will have to work for afterwards. If you give notice and they go around your boss to try to keep you, then that is a problem too. I cannot cover every edge case, but you see where I am going.
Oh, and you are eminently replaceable. They may have to spend more money to get someone who can do your job (sometimes hiring two people to cover your duties). They may have to move deadlines or change scope on their project to get it out without you. If it is true that "You can't leave, the company will fail" then someone has not done basic risk mitigation and that isn't a company that will be around for you to be loyal to in a year. I have worked for companies that saw 100% turnover in developers and survived just fine.