Looking at your example, the very fact that B now owns 51% of A means that it doesn't have to force a sale of the remaining 49% - it can effectively direct A to do what it wants. Any further ownership is meaningless unless A is seriously under capitalized and B knows it.
Now, there are only certain conditions in which that majority could force the remaining stock holders to sell their stock. The first is if there is a Buyout Agreement in place - which is more common to see in small companies and isn't something you can normally retroactively apply.
The second is if there is a Bring Along provision. Basically a provision in the shareholder agreement where if a certain percentage of the stock holders agree to sell, then the rest must sell. However this normally lays out a price floor and is generally only used in tax free mergers and acquisitions because it can create a tax problem for the shareholders. Again, this is something that isn't applied retroactively.
Some mergers in certain locations (such as Delaware and Texas) can force shareholders to sell. But those are a very particular set of circumstances.
Bear in mind that in any of these situations the shareholders could sue over the price paid per share. If the forced sell is for under market value then company A's shareholders would likely win big.
All of this to say: Yes, your proposal could happen in a number of locations.
That said, your statements that B wins and A is worthless is incorrect. If company A really was only worth about $9m then company B paid about 51m too much and their own shareholders would be screaming about it. If company A is worth far more than that, then company A's shareholders would prevail in a lawsuit to either stop the sale or force B to pay market value.