I don't know if there is a way for a smart contract to create another smart contract itself.
However, I'd say the use case for this would have to be pretty damn extravagant.
Given your token factory example, it wouldn't make sense to approach it that way. In EOS, instead of generating a smart contract per token you would have multiple tokens based off the same contract where only the creator of a particular token can administer this.
The best example of this is the
eosio.token contract where the idea is anyone can create their own token and all share the exact same smart contract.
This is much more efficient as instead of 1,000 tokens taking the RAM utilisation of 1,000 smart contracts, it's just using 1 and people can depend further on it's code, it can be unhealthy for every single dev to create their interpretation of a token contract when it can be standardised.
Therefore, if you're looking for users to be able to administer X you should try see if you can structure one and only contract for everyone to use.
Given RAM prices, this can also amount to a huge difference in costs.