Distributing source code with user-created plugins?

I have a question about the source code distribution.

So you guys probably know that iD Software releases their source code for free for most of the PC versions of the video games that they develop like DOOM and Wolfenstein.

My question is for video game developers who develop video games on PC can they release the source code for free for those video games? I know you have to pay every month for a subscription for Unreal Engine 4 but I was wondering if Epic Games can come up with a solution somehow to let video game developers release the source code for the video games that they develop if they want to? Because there are a lot of PC gamers who like to program for video games like DOOM and Wolfenstein but don’t want to pay every month. Any possibilities to do this without actually getting the source code for Unreal Engine 4 but the video game only?