Thinking aloud, I wonder how it would go if a program explicitly said we are not interested in transfers and sought out 4 year commits. Nothing enforceable, but a culture and expectation that says you are coming here to stay and we are not planning to replace you with anyone from the portal. Probably would be naive to think something like that would work, but you do have to wonder if it would be an attractive environment for a certain percentage of recruits.
it's a great plan until one of your best players leave for a competing program through the portal and you don't have a good replacement lined up. Your program is at an active disadvantage if you chose to ignore the recruits coming into the portal. It would turn the program into a place where you go to get your playing time and leave for a better program.
I don't particularly like what the portal has become, which is essentially a less regulated free-agency for the top P5 programs, but it's now deeply integral in the off-season prep for upcoming season. If you don't use the portal to your advantage, you're leaving the best players available for other programs to scoop up and leave you in the dust.