Sounds like a perpetual motion machine. You can build such a circuit but it wouldn't do anything. THere are losses in charging the capacitor and frictional losses in the motor. Even in a perfect world where perpetual motion machines world, having the capacitor there doesn't make any difference. You might as well just power DC motor 1 directly from DC motor 2.
There are losses when you connect the main battery to the system so the energy that would be stored in your capacitor would always be less than the energy that you drew from the battery. As the energy cycled through back and forth from the capacitor after you removed the battery, you would lose energy each time until you had no energy left and the system stopped. In real life, nothing visible would happen other than the system just stoppig because capacitors don't store much energy in the first place and would dissipate all its energy almost instantly after removing the battery.
It's the same as pouring water back and forth between two cups, and spilling a bit each time. Eventually you end up with no water left, and none of that water was used to do anything useful. In a perfect, frictionless, lossless world, the thing would run forever (but so would just getting a single motor to start spinning and then disconnecting the battery, no friction so it keeps spinning forever). Both systems would stop when you tried to draw energy from them since you then remove the energy from the system. It wouldn't keep running. All that is happening is the intial energy in the system has no where to go. As soon as you remove it by using it to power something else, the system stops.