I couldn't agree with you more. It's not illegal currently but should be. Alternatively as others have suggested, if you stop making a medication other companies should be able to make a generic version.
Others have called this "ever-greening" but that's not completely right. The Namenda XR is evergreening but what Actavis/Forest (it was Forest when this started, now they are part of Actavis), what they have been doing is known as a "forced-switch" and has only been tried a few times. Its been extremely effective. Companies normally lose 90% market share when a generic comes out, but if they've done a forced-switch a year or more in advance it is usually only around a 25% loss.
Forest (now Actavis) has been desperate since the patent expired on their other blockbuster drug, Lexapro, in 2012. This was an attempt to retain the marketshare of their other blockbuster, and would have worked if they hadn't screwed up the implementation so badly. Forest cut over $500 million from their RnD and manufacturing budget in the last 2 years which I'm guessing is part of why they couldn't ramp up manufacturing of the new extended release quickly enough. Drug makers have to report on shortages and potential shortages to the FDA, and Forest/Actavis was fully aware that they could not make enough of the extended release to cover all the people they were forcing off of the instant release. However they decided to stop the manufacturing lines making their instant release anyway, since they knew the longer they kept making the instant release the more market share they would lose to the generic manufacturers when the patent expired. They really are scum.