Thank you for using our forum. I am another expert on the forum, my name is ***** ***** I hope to assist you today.
While I do not have all of the details of your account or the transactions at issue, I am going to speculate that your home was "cross collateralized" in the mortgage transaction originally.
What this means is that the loans that you took out from the bank were made in such a way that if you defaulted on one, the bank still had the right to collateral against your other property. (This is not illegal, and it is commonly done, particularly with smaller banks and credit unions).
The issue that is harder for me to address here, and that you really are going to want to go over with the attorney that represented you in your bankruptcy case, is what exactly happened with the loan in your bankruptcy.
What often happens in bankruptcy matters where the debtors keep their primary residence is that they make what is called a "reaffirmation agreement" with the lender, so while the loan would be eligible for discharge (so you wouldn't owe it anymore), the tradeoff would be that the collateral (the home and property) would have to be liquidated (the mortgage is a secured loan).
I would speculate that as you still own your home (albeit with a mortgage still on it) that you entered into a reaffirmation agreement and that is why your loan survived the bankruptcy.
If you are still in financial distress, it can be worth filing for bankruptcy protection again. A good bankruptcy attorney can consult with you and go over your entire financial portfolio and what options are available to you. (Do this as a form of exploring your options and pre-bankruptcy planning, simply speaking to a bankruptcy attorney does not obligate you to file).
You can also try refinancing your current mortgage obligation. After reviewing your mortgage with the attorney that managed your prior bankruptcy (please confirm my speculations above, do not rely on this "general information" alone), I understand you are having issues based on low income and low credit scores, but there are often options out there particularly if you are willing to work with a loan broker or small lender (credit unions are particularly good options). (do not use "credit repair companies" or similar agencies, these are almost all fraudulent, please read the FTC articles about these companies prior to engaging any such company - almost everything they actually do you can do yourself, and many will simply take your money and do nothing (or even make your situation worse)).
But in response to your primary question "is my mortgage illegal" - I really doubt it.
Although again, this is "general information" and a local attorney can review all of your documents and see what, if any, contractual defenses you can raise to the specific documents, and what, if any, issues should have been raised in your bankruptcy (although I will caution you here - the statute of limitations is going to be an issue with any of these claims)